BTW, there's no need to make the script bash specific, we can use expr instead:
- i=$(($i+1))
- i=`expr $i + 1`
That isn't a bashism, it is required to be supported by any shell that claims to be Posix compliant. That probably means everything except an AT&T/SYSV bourne shell.
If you are in a loop then running expr will slow things down. It is possible to count in the old bourne shell by doing: in="$in i" set -- $in i=$# But unless you actually have a real problem it isn't worth while. Solaris users need to put /usr/xpg4/bin before /usr/bin in PATH to get a Posix compiant shell (aka ksh).
David