Created
August 9, 2018 08:35
-
-
Save andybeak/d105f071e2c9e56428292bd5fd4038c8 to your computer and use it in GitHub Desktop.
Bash - check dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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