transmission icon indicating copy to clipboard operation
transmission copied to clipboard

The script is a bash script and not an sh script

Open josch opened this issue 6 years ago • 2 comments

The shebang line claims that the script can be executed with /bin/sh, which is usually a POSIX compliant shell. But the script uses features that are bash features and not covered by POSIX. Most prominently it makes heavy use of echo -e which is not part of POSIX but supported by bash and some other shells. I suggest to either:

  • change the shebang line to explicitly declare that this script requires bash as the interpreter, or to
  • remove the bashism from the script to make it POSIX compliant

In Debian and derivatives like Ubuntu you can use the script checkbashisms to get a list of bash-only features that your script is using. Besides echo -e you also make use of ${PARAMETER//[0-9]}.

josch avatar Jan 26 '18 06:01 josch

@Alkaris That's what "remove the bashism from the script" means, yes. But that's not enough. There are other things like ${PARAMETER//[0-9]} that would have to be replaced by something else.

josch avatar Mar 12 '18 06:03 josch

Good noted! My rookie bad. I have used it on an OpenWRT router. For now, I will change the shebang line. Ideally, it would be fully POSIX. Sorry for the delay.

oilervoss avatar Mar 26 '18 19:03 oilervoss