Skip to content

Instantly share code, notes, and snippets.

@nfekete
Forked from fhuitelec/check_if_array_is_empty.zsh
Created September 15, 2023 22:38
Show Gist options
  • Save nfekete/be9299afa3b69995d26f91a8524caf68 to your computer and use it in GitHub Desktop.
Save nfekete/be9299afa3b69995d26f91a8524caf68 to your computer and use it in GitHub Desktop.
[Check if array is empty] #zsh #shell #cheatsheet
#!/usr/bin/env zsh
#
# Check if array is empty
#
typeset -A knock_sequences
if [ ${#knock_sequences[@]} -eq 0 ]; then
echo "No knock sequence found."
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment