Shell Scripting

Bash Examples

Control

if

if [ -z $IORUNNING ]
then
  echo check that io is running
fi
        

For each line in a file

while read line; do echo line; done < inputfile.txt
        

Logic

String Comparison

-z $VARIABLE returns true if null

$A != $B not equals

Logical Operators

-o logical or

        if [ $IORUNNING != "Yes" -o $SQLRUNNING != "Yes" ]