case $foo in a) echo “foo is A” ;; b) echo “foo is B” ;; *) echo “foo is not A or B” ;; esac doubleit() { expr $1 \* 2 } doubleit 3 # returns 6 function declaration and calling syntax A for loop for i in * do echo “File is $i” done iterates through its input (which is subject to globbing) case is a good way to avoid iterating through many if/elif/elif/elif constructs.