Created
October 11, 2016 12:56
-
-
Save thiagorider/88242eb5262cdf6229395aad19cb2c6a to your computer and use it in GitHub Desktop.
Check dependencies on executables in a script.
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
| #!/bin/sh | |
| s=0 | |
| if [ -x "$(which curl)" ] ; then #This is the best option for checking... | |
| echo "Utility ...... curl [ ok ]" | |
| else | |
| echo "Utility ...... curl [fail]" | |
| s=1 | |
| fi | |
| if [ -f "/bin/grep" ] && [ -x "/bin/grep" ] ; then | |
| echo "grep [ ok ]" | |
| else | |
| echo "grep [fail]" | |
| s=1 | |
| fi | |
| if [ -f "/usr/bin/expr" ] && [ -x "/usr/bin/expr" ] ; then | |
| echo "expr [ ok ]" | |
| else | |
| echo "expr [fail]" | |
| s=1 | |
| fi | |
| if [ -f "/bin/sed" ] && [ -x "/bin/sed" ] ; then | |
| echo "sed [ ok ]" | |
| else | |
| echo "sed [fail]" | |
| s=1 | |
| fi | |
| if [ $s -eq 0 ]; then | |
| echo "All requirements are met." | |
| else | |
| echo "Install requirements before proceeding! " | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment