gabriel rosenkoetter on Sat, 30 Mar 2002 20:30:14 +0100 |
On Sat, Mar 30, 2002 at 07:03:37PM +0100, Jeff Abrahamson wrote: > I want to be able to say > > foo --switch 1 --baz dog --bar a b c > > and run foo with options switch == 1, baz == 2, bar set, and args a, > b, and c. Of course, options may not be specified or may be specified > in a different order. while [ $# -gt 0 ] ; do # parse $1 shift 1 done From (NetBSD's) sh(1): shift [n] Shift the positional parameters n times. A shift sets the value of $1 to the value of $2, the value of $2 to the value of $3, and so on, decreasing the value of $# by one. If there are zero posi- tional parameters, shift does nothing. -- gabriel rosenkoetter gr@eclipsed.net Attachment:
pgpLsRtCy0cpf.pgp
|
|