Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yeasy
Last active December 20, 2016 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yeasy/df4708484eddb802928265e5de08fac4 to your computer and use it in GitHub Desktop.
Save yeasy/df4708484eddb802928265e5de08fac4 to your computer and use it in GitHub Desktop.
## Check params number is 1
if [ "$#" -ne 1 ]; then
echo "Number of parameters is not one"
exit
fi
## Check a variable is empty
[ -z "$var" ] && echo "Empty" || echo "Not empty"
## Check a cmd exists or not
command -v wget >/dev/null 2>&1 || { echo >&2 "wget is not installed. Aborting."; exit 1; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment