It seems you should try using the bash builtin variable '
$#', which contains the number of arguments. This can be used as your loop counter, which is what it appears you are trying to achieve. Also, you probably want to apply the
shift operator, to shift each argument into '$1'. This snippet (untested) should demonstrate.
Code:
#! /bin/sh
echo $#;
i=0
j=$#
while [ $i -lt $j ] ; do
echo $i $1
shift
i=`expr $i + 1`;
done
--- rod.