getopts problem
Glenn Spell
glenn@gs.fay.nc.us
Tue Nov 9 23:35:00 GMT 1999
On 9 Nov 1999 around 9:04AM (-0500) Christopher Faylor wrote:
> On Tue, Nov 09, 1999 at 01:44:00PM +0000, Clive Bostock wrote:
>
> >However I now find that unless the 1st line of the shell script
> >has the #!path_to_bash/bash included, bash errors with "getopts
> >not found".
>
> /bin/sh != /bin/bash
>
> That's why.
Well, more precisely, the /bin/sh he's using does not contain a
builtin getopts function like bash does.
One solution is to change your SHELL environment variable.
Another solution is:
< http://www.fay.nc.us/~glenn/cygwin/sh.exe.gz >
This is a port of "ash" that does contain a builtin getopts. It also
contains an alias builtin. And it will read a .profile if the PPID
and PID are the same, which is usually the case when starting it from
a batch file.
Frankly, I believe /bin/sh should be the "system" shell for Cygwin,
just as it is for FreeBSD and NetBSD. In fact, I only joined the
developers list when Chris posted "Just say no to ash"... I intended
to start hollering and screaming... but before I got my information
together, he changed his mind.
As an aside, this great little program should be referred to as
"sh" instead of "ash". Yes, it is based on ash but it's more than
ash. (Hell, nvi is based on elvis but people don't call nvi elvis,
they call it "vi".) But I call it ash in this post so everyone will
know what I'm talking about.
When it comes to an open source posix compatible Bourne type shell,
ash is as good as it gets. (Anyone ever try running a miminally
configed bash in posix mode calling it as "sh". No thank you, at
least... not on Cygwin.)
I made this last August from the ash source in NetBSD current. I
have never gotten around to going back and adding the stuff that
Chris got from the FreeBSD port... brace expansion and some signal
handling stuff if I recall correctly.
Somewhere I have a comparison of my ash with the one that Chris
ported from FreeBSD and posted about in the developers list.
Chris, is the /bin/sh on the CD the same as the one you had up in
your ftp area? (Sorry, I haven't purchased the CD yet.)
-glenn
--
________________________________________ _ _____
) )_ _ (__\____o /_/_ |
) Glenn Spell <glenn@gs.fay.nc.us> ) >-----._/_/__]>
)________________________________________) `0 |
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
More information about the Cygwin
mailing list