Bash tips and tricks
Is variable empty or unset?
if [ -z "${MY_VAR}" ]; then
  echo "It's empty or unset"
fiDefault values
${MY_VAR-default} # If MY_VAR is defined, use it; otherwise defaultFor variations on the theme, see e.g. Bash FAQ.
if [ -z "${MY_VAR}" ]; then
  echo "It's empty or unset"
fi${MY_VAR-default} # If MY_VAR is defined, use it; otherwise defaultFor variations on the theme, see e.g. Bash FAQ.