delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/11/10/02:36:31

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <19991110023536.A27087@ba.best.com>
Date: Wed, 10 Nov 1999 02:35:36 -0500
From: Glenn Spell <glenn AT gs DOT fay DOT nc DOT us>
To: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: getopts problem
Mail-Followup-To: cygwin AT sourceware DOT cygnus DOT com
References: <199911091350 DOT NAA00636 AT uksn71> <19991109090415 DOT A3345 AT cygnus DOT com>
Mime-Version: 1.0
X-Mailer: Mutt 0.93.2i
In-Reply-To: <19991109090415.A3345@cygnus.com>; from "Christopher Faylor" on Tue, Nov 09, 1999 at 09:04AM
Organization: the aerie

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 AT gs DOT fay DOT nc DOT us>    )     >-----._/_/__]>
 )________________________________________)               `0  |

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019