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

set -u #37

Open
petef4 opened this issue Apr 5, 2016 · 1 comment
Open

set -u #37

petef4 opened this issue Apr 5, 2016 · 1 comment

Comments

@petef4
Copy link

petef4 commented Apr 5, 2016

I would add set -u into your advice for set -eo pipefail, i.e. set -euo pipefail

An enhancement to that is to fail early in a script with useful feedback.

: ${FOO:?You have not set the FOO variable}
@ernstki
Copy link

ernstki commented Oct 18, 2020

I have mixed feelings about set -e in a library script with a lot of functions that do something like

is_integer() {
    [[ $1 =~ ^[-0-9][1-9]*$ ]]
}

…but totally agree that -u needs to be in there 100% of the time.

ernstki added a commit to ernstki/bashstyle that referenced this issue Oct 18, 2020
ernstki added a commit to ernstki/bashstyle that referenced this issue Oct 18, 2020
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