Hi! Long time no see! I spend more time away from the computer nowadays (a good thing, really!) ... but I have also been shell scripting a bit
Typically I start a script with
#!/bin/sh and then try to keep it portable... at least across a Debian-based distro, where
/bin/sh is dash, and Core, where
/bin/sh is busybox.
That's great. But sometimes some "bashisms" makes the script (and my life) easier. Busybox shell is no bash (no arrays, etc...) but it seems to support quite a few bash constructs (including useful "substitution patterns" between
${ and
}, etc... ) that dash doesn't grasp. Using bashisms moderately, I'd then end up with scripts which still work well in Core (with busybox sh) and also work well in other distro, but this time with bash, no longer dash.
Ok, again, that's great. But the shebang remain an issue with those scripts:
#!/bin/bash is required to run them outside of Core but this shebang doesn't work in Core (assuming bash extension isn't loaded). To correct this, I created a one-liner
/bin/bash to accommodate the
#!/bin/bash syntax in Core:
$ cat /bin/bash
# exec busybox sh -c "$0 $@"
Since this
/bin/bash is only a few bytes, I submit it for your consideration to include it in the base. This way one could use scripts with
#!/bin/bash shebangs and "moderate" bashism. Also useful as nowadays more and more people start writing any shell script with a
#!/bin/bash shebang anyway.