Skip to content

Instantly share code, notes, and snippets.

@fhuitelec
Last active November 25, 2017 06:12
Show Gist options
  • Save fhuitelec/036435fdbde85a7d3df76593818c6c86 to your computer and use it in GitHub Desktop.
Save fhuitelec/036435fdbde85a7d3df76593818c6c86 to your computer and use it in GitHub Desktop.
[Check command is installed] Cheatsheet to check if command is installed #zsh #shell #cheatsheet
#!/usr/bin/env zsh
#
# Check command is installed
#
if ! [ -x "$(command -v jq)" ]; then
echo 'Error: jq is not installed. Please install it to run this command' >&2
exit 127
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment