This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How do I make /bin/sh=sh


> Hi,
> 
> As I understand it, next time I update my cygwin installation, my /bin/sh
> will be a bash.
> 
> If this is correct, how do I get sh back again, the easiest way. Also, it
> would be nice if I shouldn't think about it each time I update.

Cygwin sh has always been something else; there is no standalone
package named sh.  /bin/sh used to be ash.  So, 'cp /bin/ash /bin/sh'
restores the old behavior.  However, it was a conscious decision for
cygwin to move away from ash, so every time you use setup.exe to
upgrade bash, it is currently setup to reinstall bash over ash, and you
will have to re-copy ash if you really want it as your sh.  Also, ash is
not POSIX-compliant, and will not be supported very well on this list.

On the other hand, if you want ksh or zsh to be your /bin/sh, copy
that one over (they both strive for POSIX-compliance, as does bash,
so they should be pretty interchangeable), and bash upgrades
should leave them alone if you made it your sh.  Again, it will not be
the standard installation, but I tried hard to not make it impossible
to do that replacement.

Actually, I'm playing with a change to bash, soon to be bash-3.0-12,
where the postinstall script will leave /bin/sh alone if its timestamp
is newer than /bin/bash.  So, with that change, you would even be
able to leave /bin/sh as ash by using 'touch' to put it waaay into the
future.

> 
> The reason is, that I develop a lot of scripts on my cygwin installation,
> but the target are different unix machines, some of them do not have bash,
> and I am afried that I might use a bash extension.

'bash --posix' is a pretty good way to ferret out bash-isms in your
scripts, to an extent.  However, there are other platforms (Solaris
/bin/sh is notoriously bad) that are non-posix compliant, and there
is no option that I know of to red flag every non-portable construct,
short of trying it out on every non-portable platform.  Also, read up
in the autoconf manual on non-portable shell constructs.  But now
that ash is dying, some of the portability workarounds needed only
for ash are starting to disappear.

--
Eric Blake
volunteer cygwin bash maintainer



--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]