This is the mail archive of the
mailing list for the Cygwin project.
Re: Question about ash and getopts
- From: seebs at plethora dot net (Peter Seebach)
- To: cygwin at cygwin dot com
- Date: Mon, 29 Dec 2003 13:00:16 -0600
- Subject: Re: Question about ash and getopts
- Reply-to: seebs at plethora dot net (Peter Seebach)
In message <DLEDLBGGCHGDFMMGKBHBAELBCDAA.email@example.com>, "Blair P. Houghto
>So I take it this "idiom" is only supposed to work in newer cygwin versions?
I dunno. It's a very, very, odd idiom, that leaves you stuck with a great
deal of manual parsing anyway.
>And I too am puzzled why someone would defeature a shell instead
>of letting it work with either method. I don't see it as a
>portability issue unless you think a significant number of users
>will be porting their scripts from systems running cygwin to systems
>running atavistic variants of UNIX.
I did check; SunOS 4.1.3 had getopts too. So, basically, it's portable
to everything except the 3b1 and 3b2, and possibly old versions of OSF/1.
But, most importantly, it's in POSIX. I can see no reason for /bin/sh to not
be at least reasonably close to a POSIX shell, when the code is already
The "it saves space" argument is implausible, and frankly counterproductive;
it should be obvious to the casual reader that calls to getopt are MUCH more
expensive than a shell with getopts in it, as is the other option, running
bash instead. A shell without getopts may be marginally smaller, such that
scripts which don't use getopts are "faster"... But did anyone actually
measure this making a difference, or is this just Little Tin God optimization
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html