Last active
April 29, 2020 07:05
-
-
Save raspberrypisig/2fe63119def22c7fb7f054ae511de375 to your computer and use it in GitHub Desktop.
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
command_installed() { | |
type -ap $1 >/dev/null 2>/dev/null | |
} | |
command_to_test="ls" | |
command_installed $command_to_test | |
if [ "$?" -eq "0" ]; | |
then | |
echo Command $command_to_test is installed. | |
else | |
echo Command $command_to_test is not installed. | |
fi | |
command_to_test="lsaaaaaa" | |
command_installed $command_to_test | |
if [ "$?" -eq "0" ]; | |
then | |
echo Command $command_to_test is installed. | |
else | |
echo Command $command_to_test is not installed. | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment