for var in item1 item2 item3; do echo $var; done
echo 1 + 1 will print 1 + 1. To (integer) evaluate use echo $((1 + 1)) or echo $[1 + 1].
For arbitrary precision pipe expression to bc -l, i.e.: echo 3/4 | bc -l.
$0 is the name of the script.$n is the nth parameter.$# is the number of parameters (excluding $0)$@ is all parameters (remaining: see below).Useful motif to have an “all remaining parameters” parameter (note that all single parameters take $1):
var1=$1 shift var2=$1 shift alltherest=$@
if [ $# -eq 0 ] then echo $usage exit fi
for var in item1 item2 item3 do echo $var done
read varname echo "varname: $varname"