Skip to content

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

Closed
TomMD wants to merge 1 commit into
curl:masterfrom
TomMD:fix/unquoted-envvar-in-bash
Closed

Fix use of `-n' with unquoted envvars#5773
TomMD wants to merge 1 commit into
curl:masterfrom
TomMD:fix/unquoted-envvar-in-bash

Conversation

@TomMD
Copy link
Copy Markdown
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
Copy Markdown
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.

2 participants