Hi,
I wrote a shell script to check if string entered is null. The test -n
option is not giving correct answer. It works fine with -z option.


echo "enter a string"
read a
 # test -n STRING
 #             the length of STRING is nonzero

if test -n $a; then echo "non zero"
else echo "zero"
fi
 # test -z STRING
 #             the length of STRING is  zero

if test -z $a; then echo "zero"
else echo "non zero"
fi

Pls tell me why is it so?


-- 
Pushparaj Shetty D.
IIT Delhi

-- 
l...@iitd - http://tinyurl.com/ycueutm

To unsubscribe from this group, send email to 
iitdlug+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to