First page Back Continue Last page Overview

 

String Tests

 
  • Strings may be tested as well

    • -z returns true if the string is empty
    • -n returns true if the string is not empty
    • operators such as =, !=, < and > may be used to compare strings as well
  • if [ $(id -u) = "0" ]; then

  • echo "You are logged in as root"

  • fi