[PLUG] How to test a string against a blank string in shell script
Shreerang Patwardhan
patwardhan.shreerang at gmail.com
Thu Mar 25 16:16:11 IST 2010
Hey all,
How do we compare a string with a blank string.
Example: String 1 = test
String 2 =
I have written a small script. Can anyone guide me to the error; if any; in
it?
Script:
echo $1 $2
if [ "$2" -a "" ]
then
echo 1
else
echo 0
fi
Output:
Case I:
./test.sh 10 20
10 20
0
Case II:
./test.sh 10
10
0
Please help!!
Regards,
Shreerang Patwardhan.
More information about the Plug-mail
mailing list