Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The script is a bash script and not an sh script #1

Open
josch opened this issue Jan 26, 2018 · 2 comments
Open

The script is a bash script and not an sh script #1

josch opened this issue Jan 26, 2018 · 2 comments
Assignees
Labels
bashism use the script checkbashisms

Comments

@josch
Copy link

josch commented Jan 26, 2018

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
Copy link
Author

josch commented Mar 12, 2018

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

@oilervoss oilervoss added the bashism use the script checkbashisms label Mar 26, 2018
@oilervoss
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bashism use the script checkbashisms
Projects
None yet
Development

No branches or pull requests

2 participants