Hello *,
quite a bunch of initscripts in IPFire 2.x contains the /bin/sh as given interpreter in their shebang line. Since /bin/sh is a symlink to /bin/bash, I guess it makes sense to rewrite them to /bin/bash accordingly.
That way, we avoid potential collateral damage by following symlinks (dangerous!) and provide additional information so tools like shellcheck know what they are actually dealing with.
Opinions?
Thanks, and best regards, Peter Müller
Hi,
I normally use /bin/bash, because I use “bashisms” and I have not a clue what is compatible with what shell.
I do not think that there is a single distribution who is linking /bin/sh to anything else than a GNU bash apart from Debian and everything that is using busybox.
The latter is totally irrelevant for us. Dash - the Debian shell is becoming less popular. People who are using fancy shells like ZSH or fish only use that for the user accounts, but the /bin/sh symlink remains untouched.
There is probably no collateral damage from changing our scripts from /bin/sh to /bin/bash. The other way round would definitely cause problems.
Hope this helps.
-Michael
On 7 Apr 2020, at 16:24, Peter Müller peter.mueller@ipfire.org wrote:
Hello *,
quite a bunch of initscripts in IPFire 2.x contains the /bin/sh as given interpreter in their shebang line. Since /bin/sh is a symlink to /bin/bash, I guess it makes sense to rewrite them to /bin/bash accordingly.
That way, we avoid potential collateral damage by following symlinks (dangerous!) and provide additional information so tools like shellcheck know what they are actually dealing with.
Opinions?
Thanks, and best regards, Peter Müller
On Tue, Apr 07, 2020 at 05:24:27PM +0200, Peter Müller (peter.mueller@ipfire.org) wrote:
Hello *,
quite a bunch of initscripts in IPFire 2.x contains the /bin/sh as given interpreter in their shebang line. Since /bin/sh is a symlink to /bin/bash, I guess it makes sense to rewrite them to /bin/bash accordingly.
That way, we avoid potential collateral damage by following symlinks (dangerous!) and provide additional information so tools like shellcheck know what they are actually dealing with.
Opinions?
In principle I like the idea. But it would take some care: bash behaves differently when invoked as sh, so you can't simply change #/bin/sh to #/bin/bash without also checking the scripts one by one to make sure they still work as they should. Most probably would as the differences are small but some might need small adjustment.