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
Closed

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

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:/#
```
@bagder
Copy link
Member

bagder commented Aug 4, 2020

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants