Last active
December 6, 2015 05:55
-
-
Save btcrooks/77a6d987f666b8c18d64 to your computer and use it in GitHub Desktop.
This script takes multiple arguments and checks if those commands exist.
This file contains 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 | |
# | |
# @description: This script takes multiple commands as arguments | |
# and checks if those commands exist on the system. | |
# Tested on bash, zsh, & ksh. | |
# | |
declare -a programs=("$@") | |
for i in "${programs}"; then | |
declare current_program="{$i}" | |
if ! type "${current_program}" >/dev/null 2&>1; then | |
# Not installed | |
echo "${current_program} is not installed on this machine." | |
else | |
# Installed | |
echo "${current_program} is installed -> $(which ${current_program})" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment