Hi,
I trying to test two condition together (AND) under bash but it’s not working…
The goal is ti have True when two variables are either not set or empty (empty string)
I’ve tried
if [[ -n VARIABLE1 && -n VARIABLE2 ]]; then
echo "OK"
fi
Here I get the “OK” no matter what .
Thanks.


Explanation
[is an alias for the programtest, so you can callman testfor more info.&&is bash syntax for conjunction. In A && B, B will only be called if A returned a exit code >0 (error). You can callman bashfor more info.||is bash syntax for disjunction. In A || B, B will only be called if A returned exit code =0 (success).trueandfalseare programs that just return exit codes 0 respectively 1.