Commit c44423e
committed
Support empty username and password for docker login.
In my testing, the check for an empty USERNAME by doing `-z "${USERNAME+x}"` always fails: it is never empty.
The `+x` seems wrong to me. A trick like that can be needed when comparing two strings, but not when checking if a single string is empty.
Let's test. First without the `USERNAME` variable existing at all:
```
$ env | grep USERNAME
$ if [ -z "${USERNAME+x}" ] ; then echo "empty"; fi
empty
$ if [ -z "${USERNAME}" ] ; then echo "empty"; fi
empty
```
Fine.
Now with `USERNAME` variable defined, and not empty:
```
$ export USERNAME=me
$ if [ -z "${USERNAME+x}" ] ; then echo "empty"; fi
$ if [ -z "${USERNAME}" ] ; then echo "empty"; fi
```
Also fine.
Now with `USERNAME` variable defined, but empty:
```
$ export USERNAME=
$ if [ -z "${USERNAME+x}" ] ; then echo "empty"; fi
$ if [ -z "${USERNAME}" ] ; then echo "empty"; fi
empty
```
The check with `=x` is wrong here.1 parent 1cd6c45 commit c44423e
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
0 commit comments