hmm.. another mistake of mine.. since you already got it.. please ignore this message
--------
i love squeezing logics in a single for loop but i can't explain how to do it anyway
..so perhaps make it simpler like a for ((;;)) statement..
make a few lines that processes the first arg then do the other processes that appends arg with the old arg in the for loop like:
Code:
arg=$1
...
shift
oldarg=$arg
for arg in "$@"; do
arg=$arg/$oldarg
...
$oldarg=$arg
done
some suggestions:
you can make arg not parse spaces by doing:
Code:
while [ $# -eq 1 ]; do
arg=$1
...
shift
done
or
Code:
for arg in "$@"; do
...
done
it's also simpler to do IFS=$'\n' in newer shells like bash