I am trying to run a small script which check for two variables to see if they are empty or not. I am getting the correct output but if also shows me error for missing right parenthesis. I tried using double parenthesis as well as round bracket but didn't work.
var=""
non="hi"
if ([ -z "$var"] && [ -z "$non"])
then
echo "both empty"
else
echo "has data"
fi
OUTPUT:
line 6: [: missing `]'
has data