yalhcru at gmail.com
Sat Aug 29 21:05:05 UTC 2015
On 8/29/15, Jim Diamond <Jim.Diamond at acadiau.ca> wrote:
>> There are slight differences when bash is run as "sh" rather than
>> "bash", but they only have to do with which startup files are read
>> (see INVOCATION section in man page).
> You are wrong on this last point (according to the bash man page).
> Aside from the startup files being different, there are other changes
> in behaviour when bash is invoked as /bin/sh. (Search the man page
> for all the sentences with "posix".)
I stand corrected, I missed the bit where it says posix mode gets enabled
when run as sh. Probably the biggest thing I see there that influences
| Subshells spawned to execute command substitutionsi [in posix mode]
| inherit the value of the -e option from the parent shell. When not
| in posix mode, bash clears the -e option in such subshells.
But this shouldn't hurt working scripts. I remember a few years back when
a lot of scripts that relied on subshells not inheriting -e suddenly had
to be changed for a new bash version (presumably the one that introduced
the -e inheritance). If they'd all had #!/bin/bash at the top, would
they have needed to be changed?
Sure would be nice if the bash manpage had a POSIX section that summarized
all the differences between regular and posix mode. Sigh.
Maybe I'll start back submitting new slackbuilds as #!/bin/bash and see
if it sticks this time around.
More information about the SlackBuilds-users