Skip to content

Instantly share code, notes, and snippets.

@rafaelmaeuer
Created July 20, 2023 14:09
Show Gist options
  • Save rafaelmaeuer/a968bbce5f0e13f2df4123710fb29306 to your computer and use it in GitHub Desktop.
Save rafaelmaeuer/a968bbce5f0e13f2df4123710fb29306 to your computer and use it in GitHub Desktop.
# -n operator: check if var is not empty
VAR="test"
if [ -n "$VAR" ]; then
echo "$VAR is not empty"
fi
# -z operator: check if var is empty
VAR=""
if [ -z "$VAR" ]; then
echo "$VAR is empty"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment