topical media & game development

talk show tell print

basic-shell-03-test-binary.sh / sh



  # Binary test.
  
  echo "**** Binary comparisons."
  x=3
  y=10
  
  echo -n "test -a: "
  if (test x -eq x -a  y -eq y)  then
      echo "x = x and y = y. Expected."
  else
      echo "false: x = x and y = y." 
  fi
  
  echo -n "test -a: "
  if (test x -eq x -a  y -ne y)  then
      echo "x = x and y = y."
  else
      echo "false: x = x and y != y. Expected." 
  fi
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.