Monday, 20 May 2013

compare as numeric value. unix

compare as numeric value. unix

So I am trying to test a few things coding in bash. As a n00b I am having some problems with the basics and how irritating it can get using shell dealing with numbers.
if $((echo $?)) > 0 ;then
  echo "there is an error";
else
  echo "it passed";
fi
the error I get is : bash: echo 0: syntax error in expression (error token is "0")
I tried without the echo and I get: bash: ./0: Permission denied
so I am a bit confused what the shell is trying to do.
Thanks

No comments:

Post a Comment