Checking if a variable is set is easy in Bash; however, there are two common scenarios: Checking if a variable is empty or unset Checking if a variable is unset Checking if a variable is empty or unset Firstly, a simple test may be used to determine if a variable’s value is empty or if it’s unset. 1if [[ -z "$var" ]]; then 2 echo "it's empty or unset" 3fiOR