I have found a code some where, which looks like
if (test $value)
then
<do something>
fi
I am not understanding what is test doing here. I have seen test with !,-eq, -e etc.
But, the above appears to be a new one to me.
Can anyone please expalin me.
kshji
July 6, 2011, 12:37pm
3
I have written sort test/if some years ago.
with no operator it is "True if string is not empty."
kshji
July 6, 2011, 12:55pm
5
if test $value # no need to create subprocess
then
doSomething
fi
if [ $value ]
then
doSomething
fi
If value is set, then test return exit code 0 = true
# about same, more generic, documentation is better
if [ "$value" != "" ]
then
doSomething
fi