[Slackbuilds-users] bashisms?

B Watson yalhcru at gmail.com
Sat Aug 29 15:25:48 UTC 2015


On 8/29/15, Jim Diamond <Jim.Diamond at acadiau.ca> wrote:

>> it'd be easy enough to sed the shebangs to #!/bin/bash

> Well, this is, I believe, something which is also wrong in principle.

In general, you're right. For the specific case of Slackbuilds, they're
all already bash scripts (since /bin/sh is bash on Slack). If Slackware
15.0 suddenly starts using dash for /bin/sh, it's safe to change the
shebang lines for SBo scripts to read #!/bin/bash.

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).

> zsh (at least with the options I get when I run it):
> $ b='echo a'
> $ $b
> zsh: command not found: echo a

Interesting. Tried this with bash. Invoking it as sh or with the --posix
flag doesn't change the way this works (it still echoes a, doesn't act
like zsh).

ash works like bash, for this case. So does ksh, and so does hsh (the
Heirloom shell). Looks like zsh might be the odd man out here.


More information about the SlackBuilds-users mailing list