Skip to content

Instantly share code, notes, and snippets.

@yeasy yeasy/Bash scripts
Last active Dec 20, 2016

Embed
What would you like to do?
## 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
You can’t perform that action at this time.