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

Using defaults and "${VAR:?}" #29

Open
stuartpb opened this issue Jan 16, 2015 · 3 comments · May be fixed by #52
Open

Using defaults and "${VAR:?}" #29

stuartpb opened this issue Jan 16, 2015 · 3 comments · May be fixed by #52

Comments

@stuartpb
Copy link

If you don't assert the existence of certain important variables, your script could inadvertently wipe the user's home directory:

ValveSoftware/steam-for-linux#3671

https://news.ycombinator.com/item?id=8896186

@stuartpb
Copy link
Author

There's also set -u

@progrium
Copy link
Owner

I generally don't like set -u, but I do like "${foo:?}" when needed.

@stuartpb
Copy link
Author

I'm not into set -u either, but it's worth noting for people who want to write their own style guides. (It's also worth noting as a "critical section" wrapper that can be paired with set +u.)

ernstki added a commit to ernstki/bashstyle that referenced this issue Oct 18, 2020
@ernstki ernstki linked a pull request Oct 18, 2020 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants