delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/01/15/21:58:46

X-Spam-Check-By: sourceware.org
Message-ID: <45AC3F4D.60508@byu.net>
Date: Mon, 15 Jan 2007 19:58:21 -0700
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com, luke DOT kendall AT cisra DOT canon DOT com DOT au
Subject: Re: Changed handling of "!" in /bin/sh?
References: <20070116023906 DOT 30AB783D05 AT pessard DOT research DOT canon DOT com DOT au>
In-Reply-To: <20070116023906.30AB783D05@pessard.research.canon.com.au>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Luke Kendall on 1/15/2007 7:39 PM:
> I have a script that starts #!/bin/sh which has occasional things like
> the use of an exclamation mark in a string, or a case statement to
> accept an exclamation mark to throw a shell, which has stopped working
> now that I've upgraded to a non-ancient Cygwin (i.e. now that sh ==
> bash).

Simple test case, please?

> 
> It seems that /bin/sh is now trying to interpret "!" as bash would! 
> How can I make /bin/sh work like a Bourne shell, globally?

You can't.  Bourne shell is obsolete (unless you are on Solaris, and are a
die-hard to use their /bin/sh instead of /usr/xpg4/bin/sh), because it
lacks functions, ${} command substitution, and other useful features of
modern shells.  Rather, you can make /bin/sh behave like a POSIX shell -
you do that by invoking bash as /bin/sh instead of /bin/bash (ie. you are
ALREADY getting POSIX behavior).  ash was slowly moving in this direction,
but had its own set of bugs.  If your legacy scripts don't behave properly
with /bin/sh, then most likely, it is a bug in your script according to
the rules of POSIX, that just happened to work with ash because of a
matching bug in ash.

> 
> The same script works fine if run by ash instead of bash, and it also
> works fine under Linux (where sh is bash), so it seems like there's
> some problem with bash's emulation of sh under Cygwin.

That's a pretty harsh claim without a sample script to back it up.  I try
very hard to make Cygwin's /bin/sh exactly like Linux's /bin/sh.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9 AT byu DOT net
volunteer cygwin bash maintainer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFrD9N84KuGfSFAYARAopHAKDFf8EUWWhnDylryGUirokRuxPpBACfUpQp
Y+DfBrwrz4vAmiV4ZKtLF34=
=vRL7
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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