Created
June 27, 2013 03:10
-
-
Save agebrock/5873670 to your computer and use it in GitHub Desktop.
check for commands
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
| my_needed_commands="sed awk lsof who" | |
| missing_counter=0 | |
| for needed_command in $my_needed_commands; do | |
| if ! hash "$needed_command" >/dev/null 2>&1; then | |
| printf "Command not found in PATH: %s\n" "$needed_command" >&2 | |
| ((missing_counter++)) | |
| fi | |
| done | |
| if ((missing_counter > 0)); then | |
| printf "Minimum %d commands are missing in PATH, aborting\n" "$missing_counter" >&2 | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment