shell script variables not set code example
Example 1: bash if set variable
if [ -z ${var+x} ]; then echo "var is unset"; else echo "var is set to '$var'"; fi
Example 2: bash if set variable
if [ -z "$var" ]; then echo "var is blank"; else echo "var is set to '$var'"; fi
Example 3: shell script variables not working
#shell does not accept spaces so:
MYVAR = 12 #is NOT correct
MYVAR=12 #is correct