SUMMARY: Command Line parsing

From: Ben Tshin <ben_at_foundmoney.com>
Date: Mon Jun 24 2002 - 15:21:25 EDT
Thanks to Sanjiv Bhatia for his VERY quick response! (10 minute wait, that's
all)

To parse through all the command-line arguments we can use the "shift"
command. It will shift positional arguments ($2 become $1).

It works with ksh and sh like in the following script
> #!/bin/ksh
>
> for i in $*
> do
>     echo $i
>     shift
> done

Also there is another solution that I totally forgot about:
for ARG in $*
do
  echo $ARG
done
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Mon Jun 24 15:21:49 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:47 EST