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.


Never use
a && b || c. It is not the same asif a; then b; else c; fi: whenasucceeds butbfails, it will run bothbandc.I would not bother with
[unless you absolutely need compatibility with non-bash shells.