When ever i run this if statement with the -n OR -z switches it always returns says positive and does "HAVE STUFF". BUT the file does not contain the word optimus in any form.
$echo this is mojo > test.file
$if [ -n `grep -i optimus test.file` ]; then
>echo HAVE STUFF
>else^Jecho NO STUFF
>fi
HAVE STUFF
$if [ -z `grep -i optimus test.file` ]; then
>echo HAVE STUFF
>else^Jecho NO STUFF
>fi
HAVE STUFF
basicly i am trying to test to see if optimus returns a postive response if it does do "HAVE STUFF" else do "NO STUFF".
the only way i have found around it is:
[ `grep -i optimus test.file|wc -l` -ge 1 ]; then........
anyone have any ideas.
SHELL: /bin/ksh
OS: sol8
platform: sparc