04-28-2005
30,
1
Join Date: Apr 2005
Last Activity: 10 April 2018, 1:49 PM EDT
Location: U.K.
Posts: 30
Thanks Given: 12
Thanked 1 Time in 1 Post
unexpected 'test' operation
Hi - I'm finding some unexpected operation when testing in a ksh script.
EG
TST=`grep donut file1`
FSZ=`ls -l file1 | awk '{ print $5 }'`
if [ -n $TST ] ; then
if [ $FSZ > 200 ] ;then
echo "Greater than 200"
else
echo "Less than 200"
fi
elif [ -z $TST ] ;then
echo "ZERO"
fi
If FILE1 does NOT contain the string 'donut' I would expect the -z to be
invoked but it doesn't because the first test just fails - how do I avoid this ??
thanks