Re: shel script problem regarding arrays
Stephane Chazelas wrote:
> On 21 Aug 2006 04:44:55 -0700, Danish wrote:
> [...]
> >> Use sed l < your-script to identify where the CRs are.
> [...]
> > I did sed my-script.sh
> >
> > But it gave me the following error....
> >
> > #sed ls2.sh
> > sed: -e expression #1, char 2: extra characters after command
> [...]
>
> I wrote:
>
> sed l < ls2.sh
>
> That the letter l (el) after sed.
>
> Or
>
> cat -vte < ls2.sh
>
> or
>
> od -c < ls2.sh
>
> Or
>
> vi ls2.sh
>
> Then
>
> :set list
>
> within vi.
>
> --
> Stephane
Sorry for being a dud...Actually Im really troubled by this
script..Here is the output after dong
#sed l < ls2.sh
and
# cat -vte ls2.sh
#!/bin/sh$
$
array=(`ls -l /home/danish/scp | tr -s " " | cut -d " " -f5`)$
$
len=${#array[*]}$
$
i=$(($i + 1))$
$
printf "%s\n" "${array[@]}" $
$
echo "ssh to 192.168.10.98 starts here"$
$
array1=`ssh 192.168.10.98 " vdir /home/danish/scp/* | tr -s \" \"|cut
-d \" \" -f5 "`$
$
n=0$
while [ $n -lt ${#array1[@]} ]$
do$
[ "${array[$n]}" -ne "${array1[$n]}" ] && echo "Error"$
done$
$
$
Thanks
Danish
|