This is the mail archive of the
cygwin-talk
mailing list for the cygwin project.
RE: Changed handling of "!" in /bin/sh?
- From: "Buchbinder, Barry \(NIH/NIAID\) [E]" <BBuchbinder at niaid dot nih dot gov>
- To: "The Cygwin-Talk Maiming List" <cygwin-talk at cygwin dot com>
- Date: Thu, 18 Jan 2007 13:37:12 -0500
- Subject: RE: Changed handling of "!" in /bin/sh?
- References: <31DDB7BE4BF41D4888D41709C476B657041696A9@NIHCESMLBX5.nih.gov> <45AEDE02.2020001@byu.net>
- Reply-to: The Cygwin-Talk Maiming List <cygwin-talk at cygwin dot com>
Eric Blake wrote on Wednesday, January 17, 2007 9:40 PM:
> According to Buchbinder, Barry (NIH/NIAID) [E] on 1/17/2007 4:14 PM:
>>> Not recommended. The reason cygwin moved to bash as /bin/sh was to
>>> avoid ash bugs.
>>
>> I thought that it was more to avoid all the complaints that sh did
>> not behave like bash, which is what many people expected.
>
> And that is different from an ash bug, how? :)
And there aren't other behaviors of cygwin than differ from what people
expect, based on their prior experience with Linux & Friends, that we
say, basically, "that's the way it is and its because of X so (submit a
patch and in the meantime) get used to it"? :-)
I still use ash as /bin/sh and for most of my scripts. In part, this
was because the argument that bash's slowness upon loading was
compensated for by the speed up one could get from bash builtin
functionality as compared with ash's need to load utilities to get the
same functionality. I felt it was easier for me to stick with ash and
not need to re-write many of the scripts. (Note: This is an explanation
of why I largely stuck with ash and was not intended as a criticism of
the sh=ash => sh=bash decision. (Though it might be nice if setup.exe
as one what sh is desired I've now got a script which checks whether sh
has been updated to bash and, if so, copies ash.exe over sh.exe.))
- Barry
- Disclaimer: Statements made herein are not made on behalf of NIAID.
# === FOR THE RECORD ==
# ==== bash vs. ash ===
/c> 0.0 /c> for Shell in bash 'bash --posix' ash; do echo; echo -n
"${Shell}" ; time for (( F=1 ; F <= 1000 ; F++ )) ; do ${Shell} -c exit
; done ; done
bash
real 0m58.662s
user 0m40.700s
sys 0m37.103s
bash --posix
real 0m57.941s
user 0m41.414s
sys 0m35.750s
ash
real 0m32.629s
user 0m35.612s
sys 0m19.356s
# === What gets run as part of a batch file loaded from the StartUp
folder ===
start /wait h:\cygwin\arc\setup.exe -R c:\cygwin -n -q -s
ftp://mirrors.kernel.org -l h:\cygwin\arc
c:\cygwin\bin\ash -c /usr/local/bin/chk_sh.sh
# === Script to check sh.exe, run after automatic run of setup upon
booting ===
$ /c> cat /usr/local/bin/chk_sh.sh
#!/bin/ash
cd /bin
if test $(stat -c %s sh.exe) = $(stat -c %s ash.exe)
then
echo 'sh.exe is ash.exe'
ls.exe --color=auto --time-style=+%F\ %T -og ash.exe bash.exe
sh.exe
else
echo 'Linking sh.exe to ash.exe'
ls.exe --color=auto --time-style=+%F\ %T -og ash.exe bash.exe
sh.exe
rm -v sh.exe
cp -pv ash.exe sh.exe
ls.exe --color=auto --time-style=+%F\ %T -og ash.exe bash.exe
sh.exe
fi