#!//bin/bash ## loop the number of times given by first arg $1 - bash version i=1 while [[ $i -le "$1" ]] ; do echo "Iteration $i (bash)" i=$(( $i + 1 )) ## $ not needed inside: $(( i + 1 )) is fine. done #!/bin/sh ## loop the number of times given by first arg $1 - sh and bash version i=1 while [ $i -le "$1" ] ; do echo "Iteration $i (sh)" i=`expr "$i" + 1` ## Spaces required around the + and $ required. done