# Setting a Variable # There can be no spaces # There should be no dollar signs A=3 B="Hi There" # Printing a variable # Dollar signs are needed echo $A echo $B # Doing basic math the WRONG way c=$A+2 echo $c # Doing basic math the right way let c=$A+2 echo $c # Array stuff. # Note the funny curly braces!!!! array[1]=3 array[100]="I like Arrays" echo ${array[1]} ${array[100]} # An if statement # The else clause is optional if [ $A == 3 ]; then echo A is 3 else echo A is not 3 fi if [ $A -eq 3 ]; then echo A is 3 elif [ $a == "four" ]; then echo A is four fi # For loops for c in 2 3 5 7 11 do echo $c is prime done for c in /usr/libexec/y* do echo $c is a file done # While loops c=1 while [ $c -lt 4 ]; do echo Counting $c ... let c=$c+1 done