usually the easiest way to handle this type of script is to use the shift function.
lets say you ran the script with 3 arguments.. test1 test2 test3
while [ ! -z $1 ]; do
$argv[$x] = $1
this would create an array with the following content:
$argv = test1
$argv = test2
$argv = test3
This happens because shift moves the entire argument list on step in. $1 will disappear and $2 will become $1, $3 will become $2.
You don't need to use an array in the while loop, you can do a case or anything you wish, the shift statement will still do what it supposed to
ps. while [ ! -z $1 ] means while $1 is not empty keep on going ds.