Help us complete this page with more examples of validation.
The simplest validation is as follows:
if [[ "$variable" ]]; then
It checks if a variable is set.
Beware, if you want to validate the value of the variable, you'll have to be more explicit:
if [[ $variable ]]; then
echo "This gets printed because the variable is set."
elif [[ $variable == 1 ]]; then
echo "This does not get printed because the variable equals 0."