How Do You Check If A Variable Is Defined In Bash?
How Do You Check If A Variable Is Defined In Bash? Determine if a bash variable is set or not : [[ ! -z ${PURGEIMAGE+z} ]] && echo “Set” || echo “Not defined” Return true if the variable is set on Bash version 4.2+ : [ -v $VAR ] && echo “Bash $VAR NOT set”