Hi there,
When I try to do a condition on test:
$ str1=abcd
$ test $str1
$ echo $?
0
Is there anyway to display the answer to be 'TRUE' or 'YES'? rather than 0?
If so, how can I do it without using awk or sed.
Hi there,
When I try to do a condition on test:
$ str1=abcd
$ test $str1
$ echo $?
0
Is there anyway to display the answer to be 'TRUE' or 'YES'? rather than 0?
If so, how can I do it without using awk or sed.
look inside you manpage "man test"... taken from solaris 10:
-z string True if the length of string string is zero.
so i think a "test -z $str1" might work...
If I get you right , you want something like this :
if [[ -n $str1 ]] ; then
echo "TRUE"
else
echo "FALSE"
fi