#!/bin/bash
i=1
while [ -n "$1" ] # $1が空っぽならループ終了
do
echo "Arg $i = $1"
shift
i=`expr $i + 1`
done
実行結果
$ ./arg.sh a b c d e f g h i j k
Arg 1 = a
Arg 2 = b
Arg 3 = c
Arg 4 = d
Arg 5 = e
Arg 6 = f
Arg 7 = g
Arg 8 = h
Arg 9 = i
Arg 10 = j
Arg 11 = k
{{tag>bash}}