Jeff Abrahamson on Sat, 30 Mar 2002 19:20:14 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] options in shell scripts


I feel I'm missing something obvious.

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.

I realized I've never written such a thing in sh. I could rewrite
in perl with Getopt::Long, but it's very much a shell thing I've got
here. Anyone have any suggestions?

Maybe I should just rewrite in perl.

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>

 The Big Book of Misunderstanding, now in bookstores and on the web:
 <http://www.misunderstanding.net/buystuff.html>


______________________________________________________________________
Philadelphia Linux Users Group       -      http://www.phillylinux.org
Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce
General Discussion  -  http://lists.phillylinux.org/mail/listinfo/plug