I want to test multiple variables to see if they are empty. So I did the following:
if [ test -z "$VAR1" ] || [ test -z "$VAR2" ]
then
echo "Empty!"
fi
However, it doesn't work. The output is:
[: -z: binary operator expected
[: -z: binary operator expected
What have I done wrong? The code above works fine if I leave out the OR (||) condition.
if [[ -z "$VAR1" || -z "$VAR2" ]]; then ... fishould work inbash[istest, not part of theifstatement's syntax. Typehelp [andhelp testat the prompt for more information.