Hello, I couldn't help wonder how I would do it in bash. This one lets the user enter all arguments first, one line at a time, then operates on the arguments.
It is more verbose than it should be, only to show usage of arrays... replace "echo "executing command"..." etc with Your actual command.
Code:
#!/bin/bash
echo Enter arguments, just press enter when finished.
cnt=0
while [ true ]; do
echo -n "Enter argument $(($cnt+1)): "
read x[$cnt]
[ "${x[$cnt]}" == "" ] && break
cnt=$(($cnt+1))
done
echo Processing $cnt arguments
cnt=0
while (($cnt < ${#x[@]}-1 ))
do
echo "executing command on argument $(($cnt+1)) which is: ${x[cnt++]}"
done
#echo ${x[@]}
/Lakris