
On Fri, Nov 11, 2011 at 01:36:05PM +1100, Trent W. Buck wrote:
getopts (bashism) is the other way I often use, but it's inherently limited to single-char variable names, which is a bit of a downer.
yep, downer is right. IMO the built-in getopts is inadequate. i've written lots of stuff using /usr/bin/getopt from the util-linux package. supports both long and short options, and pretty easy to use. similar enough to getopts usage that it should be no problem to pick up. e.g. from my myth-list-queue.sh(*) script: TEMP=$(getopt -o 'drqcehfts:AD' --long 'debug,running,queued,completed,errors,flag,transcode,sort:,ASC,DESC' -n "$0" -- "$@") in fact, i use it for anything needing more than just a list of filename(s) on the command line. (*) one of these days i should publish my myth utility scripts. craig -- craig sanders <cas@taz.net.au>