#!/usr/bin/bash
name="$@"
myname=malay
#echo $myname
select firstname in $name;
do
if [$firstname!= $myname];then
echo $firstname
else
break
fi
done
invoking with:-
./script.sh one two three four five six seven eight nine malay
according to me the program control should come out when i will select the entry having my name[malay] but its not happening
can any one point out the error
Hi,
Syntax error is there in the test condition. space must be there after the opening bracket and bfore the closing bracket, like this
if [ $firstname != $myname ];then
Thanks
Penchal
put this line at the beginning of the script and debug it.
set -x
ash-3.00$ ./script.sh one two three four malay
one two three four malay
malay
1) one
2) two
3) three
4) four
5) malay
#? 1
./script.sh: line 12: [: one!=: unary operator expected
bash-3.00$
this is the error coming
what are the changes that you made to the script
make the changes as penchal suggested it will work fine for you..
There should be space as he suggested.
Thanks
okay i got hold of the error
[ $firstname != $myname ]
...i was missing the spaces in between
thanks everyone who cared to help