JD Runyan wrote:
> Todd Walton wrote:
> >So, that's a problem with the script writer saying "#!/bin/sh" when
> >his/her script won't actually run under sh. But I see now what
> >Stewart was arguing against.
> >
> >If "sh" is always bash for most people, that causes incorrectly
> >written shell scripts, whoever's fault it is.
>
> Older versions of bash would limit itself to bourne functionality when
> run as sh. Does the newer version not do that anymore?
It never did. I can think of two specific cases:
1) export VAR=moo;
2) trap USR1 USR1
In sh, those are both illegal. Under bash-masquerading-as-sh, they are
both legal.
[EMAIL PROTECTED]:~]% ARGV0=sh bash
sh-3.00$ export MOO=cow
sh-3.00$ bash
[EMAIL PROTECTED]:~]$ echo $MOO
cow
[EMAIL PROTECTED]:~]$ exit
sh-3.00$ exit
[EMAIL PROTECTED]:~]% sh
$ export MOO=cow
MOO=cow: is not an identifier
[EMAIL PROTECTED]:~]% ARGV0=sh bash
sh-3.00$ USR1() { echo usr1 ; }
sh-3.00$ trap USR1 USR1
sh-3.00$ kill -USR1 $$
usr1
sh-3.00$ exit
[EMAIL PROTECTED]:~]% sh
$ USR1() { echo usr1 ; }
$ trap USR1 USR1
$ kill -USR1 $$
zsh: user-defined signal 1 sh
I submitted a bug to the FSF about the second issue, and was sent a note
back politely telling me they did not care.
-john
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list