[Mingw-users] sh vs bash

35 views
Skip to first unread message

LRN

unread,
Mar 29, 2012, 5:00:35 PM3/29/12
to MinGW Users List
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Why does msys.bat run /bin/sh for MSys-in-cmd, but /bin/bash for
MSys-in-mintty?

Is there a particular reason to emulate POSIX shell with bash?

I'm asking, because bash in POSIX shell mode does not source ~/.bashrc

I highly doubt that most Windows users know what POSIX mode is, or
care about its features.

Debian runs its login shell in with POSIX mode disabled by default.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPdM1zAAoJEOs4Jb6SI2CwGC4IAItGpstRf3JpW5RSBigkC+2I
dC+eug64WPmVz8CYh72bdqR2lcGD9U9j/U8d4OHiQMlafsBbPVLV3WK1n80nVLvf
dLjHoottmBp++uojBkpDjFCY0FzFqGkMMsC1MnWG4SGj1Evk5xzmzYkipNEVpx73
9x7QQv3uSNlAB6czPhUX1ayhQoLAfYAnSNYKUN/nNcf4gbImbYuyJaK+vTZVZINs
HbzimvyZTZpxMJIqvBWaZrdsuXrsUM6z8JQKPGw2Y12dlbEVcPdeFJLgtc9ziOnM
iU5moTYsyPDxDrqxHUWdpSzPBb2wkvDw7NhhhnOUYukOjiIyWf1cWQBEaMifZBk=
=01Xs
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
MinGW-users mailing list
MinGW...@lists.sourceforge.net

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-use...@lists.sourceforge.net?subject=unsubscribe

Keith Marshall

unread,
Mar 30, 2012, 7:33:26 AM3/30/12
to MinGW Users List
On 29/03/2012, LRN wrote:
> Why does msys.bat run /bin/sh for MSys-in-cmd, but /bin/bash for
> MSys-in-mintty?

I don't know the rationale for these differing choices, but...

> Is there a particular reason to emulate POSIX shell with bash?

Some configure scripts may require it; all should be compatible
with /bin/sh, so there is little need to expose the more advanced
capabilities of bash by default.

> I'm asking, because bash in POSIX shell mode does not source ~/.bashrc

So what? When invoked as a login shell, full bash mode doesn't
either, (unless you explicitly source it from .bash_profile). It is only
when invoked as a secondary shell, that .bashrc is automatically
sourced; in this case, *you* have full control over whether you
run sh.exe or bash.exe, so I don't see a problem.

> I highly doubt that most Windows users know what POSIX mode is, or
> care about its features.

Nor should they have any reason to care. Unless they specifically need
some extended feature of bash, sh.exe should suffice; how many of your
average Windows users will be conversant with bash's capabilities?

> Debian runs its login shell in with POSIX mode disabled by default.

Which is relevant ... why?

--
Regards,
Keith.

Earnie Boyd

unread,
Mar 30, 2012, 8:03:06 AM3/30/12
to MinGW Users List
On Fri, Mar 30, 2012 at 7:33 AM, Keith Marshall
<keithm...@users.sourceforge.net> wrote:
> On 29/03/2012, LRN wrote:
>> Why does msys.bat run /bin/sh for MSys-in-cmd, but /bin/bash for
>> MSys-in-mintty?
>
> I don't know the rationale for these differing choices, but...
>

See below.

>> Is there a particular reason to emulate POSIX shell with bash?
>
> Some configure scripts may require it; all should be compatible
> with /bin/sh, so there is little need to expose the more advanced
> capabilities of bash by default.
>

This ...

>> I'm asking, because bash in POSIX shell mode does not source ~/.bashrc
>
> So what?  When invoked as a login shell, full bash mode doesn't
> either, (unless you explicitly source it from .bash_profile).  It is only
> when invoked as a secondary shell, that .bashrc is automatically
> sourced; in this case, *you* have full control over whether you
> run sh.exe or bash.exe, so I don't see a problem.
>

And this are the rationale.

Cygwin at the time used ash for its /bin/sh and I chose bash since I
didn't want more than one shell distributed with something called
Minimal SYStem.

--
Earnie
-- https://sites.google.com/site/earnieboyd

Earnie Boyd

unread,
Mar 30, 2012, 4:04:00 PM3/30/12
to MinGW Users List
On Fri, Mar 30, 2012 at 8:06 AM, LRN wrote:
> Which means that POSIX/non-POSIX mode decision mainly affects
> interactive login shell (the one run by msys.bat; i'm assuming that a
> user running sh.exe/bash.exe manually, not via msys.bat, is capable of
> making mode decision for h[im/er]self).

The savvy user could bypass msys.bat altogether. Originally msys.bat
did some environment configuration beyond starting the shell but that
has been moved to /etc/profile. The configure script uses #!/bin/sh
and the goal for MSYS when it was created was simply based on being
able to execute the configure script in a build environment publishing
itself as MINGW32. If the user wishes for more, it is possible, but
the onus is the users.

------------------------------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages