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

Fix use of `-n' with unquoted envvars #5773

Closed
wants to merge 1 commit into from

Conversation

@TomMD
Copy link
Contributor

@TomMD TomMD commented Aug 4, 2020

Shellcheck tells us "-n doesn't work with unquoted arguments. quote or use [[ ]]."

And testing shows:

docker run --rm -it ubuntu bash
root@fe85ce156856:/# [ -n $DOES_NOT_EXIST ] && echo "I ran"
I ran
root@fe85ce156856:/# [ -n "$DOES_NOT_EXIST" ] && echo "I ran"
root@fe85ce156856:/#
Shellcheck tells us "-n doesn't work with unquoted arguments. quote or use [[ ]]."

And testing shows:

```
docker run --rm -it ubuntu bash
root@fe85ce156856:/# [ -n $DOES_NOT_EXIST ] && echo "I ran"
I ran
root@fe85ce156856:/# [ -n "$DOES_NOT_EXIST" ] && echo "I ran"
root@fe85ce156856:/#
```
@TomMD TomMD force-pushed the TomMD:fix/unquoted-envvar-in-bash branch from e5468ce to 0b480d1 Aug 4, 2020
@bagder
bagder approved these changes Aug 4, 2020
@bagder
Copy link
Member

@bagder bagder commented Aug 4, 2020

Thanks!

@bagder bagder closed this in 30974cb Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.