2 ms·
I hate when people do that because it's not needed at all. The quoting already fixes everything. if [[ "$VARIABLE" == "" ]] or even better if [ -z "$
by viraptor 13y ago
I hate when people do that because it's not needed at all. The quoting already fixes everything.
if [[ "$VARIABLE" == "" ]]
or even better
if [ -z "$VARIABLE" ]
will handle undefined, empty and multiple words just fine.
- twic 13y agoUnless you're running with -u, which you should be, in which case it will blow up on an undefined variable. To treat undefined as empty, you want: if [[ -z "${VARIABLE:-}" ]]