Check two conditions in bash ?
Check two conditions in bash ?
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
bash
if [[ -n VARIABLE1 && -n VARIABLE2 ]]; then echo "OK" fi
Here I get the "OK" no matter what .
Thanks.
To check for an empty string, use
-z
.-n
checks to see if a string is not empty.in
[[
, empty strings are falsy, so this also works: