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

Make bash more strict #3

Open
cjgillot opened this issue Jul 12, 2020 · 1 comment
Open

Make bash more strict #3

cjgillot opened this issue Jul 12, 2020 · 1 comment

Comments

@cjgillot
Copy link

Bash has a lot of implicit semantics for non-existent variables.
This can cause competing directives (like $OMP) to be eaten silently.

Setting a stricter mode for bash by default can help a lot.

set -e # Abort on first error
set -u # Err on undefined variable
set -o pipefail # Err on redirection failure

This would be a breaking change. The zpp standard library is not set -u safe.
See gysela merge !633 for a few examples.

@jbigot
Copy link
Owner

jbigot commented Jul 21, 2020

I fully agree with set -u and -o pipefail. Regarding -e however, this breaks some perfectly valid patterns like:

dosomething
if $?; then ...

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

No branches or pull requests

2 participants