Skip to content

Instantly share code, notes, and snippets.

@andybeak
Created August 9, 2018 08:35
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 andybeak/d105f071e2c9e56428292bd5fd4038c8 to your computer and use it in GitHub Desktop.
Save andybeak/d105f071e2c9e56428292bd5fd4038c8 to your computer and use it in GitHub Desktop.
Bash - check dependencies
#!/usr/bin/env bash
SCRIPT_DEPS="python terraform ssh-keygen ssh-add"
function die {
echo $1 >&2
exit 1
}
function missing_deps {
die "Dying: Missing script dependencies: $SCRIPT_DEPS"
}
function check_dep {
which $1 2>&1 > /dev/null
[ $? -eq 0 ] || missing_deps
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment