Last active
February 13, 2024 15:08
-
-
Save Justman100/e6b29dd03d0fd876166075c96785d5d3 to your computer and use it in GitHub Desktop.
Checks whether server-side languages (NodeJS, Python, Java etc) and databases (MariaDB / PostgreSQL etc) are installed and linked
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
#/bin/bash | |
# Usage: | |
## . checkFor | |
## checkFor PACKAGE | |
checkFor() { | |
langs=( | |
mysql | |
mariadb | |
postgre | |
postgres | |
postgresql | |
redis | |
ruby | |
lua | |
) | |
for cmd in "$@" ; do | |
for lang in ${langs[@]}; do | |
! [ $cmd == $lang ] && echo "This is not a database system or serverside code language or it is not supported" && exit 1 | |
done | |
if ! command -v "$cmd"; then | |
if ! [ -d /usr/local/$cmd ]; then | |
echo "$cmd is not installed!" | |
exit 1 | |
fi | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment