Hi ,
I have a doubt on condition test ( [[ ]] ). Pls refer blow program.
#!/bin/ksh
TEMP=
if [ -n $TEMP ];then
echo $TEMP
else
print 'invalid option'
fi
Above script's TEMP variable has no value so it gives "invalid option" as output. But I got an error before priting the string .
Result :
./test.ksh[3]: test: argument expected
invalid option
#!/bin/ksh
TEMP=
if [[ -n $TEMP ]];then
echo $TEMP
else
print 'invalid option'
fi
Result:
invalid option
After I tried IF conditon with condition test [[ ]] , I did not see the error (./test.ksh[3]: test: argument expected ).
Why I don't see the error now?.
How Condition test [[ ]] is actually working ?.
How [[ ]] differ from normal if condition?
Regards,
Thambi