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.
while [ $i -lt $j ] ; do
echo $i $1
i=`expr $i + 1`;