Skip to content

Instantly share code, notes, and snippets.

@Justman100
Last active February 13, 2024 15:08
Show Gist options
  • Save Justman100/e6b29dd03d0fd876166075c96785d5d3 to your computer and use it in GitHub Desktop.
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
#/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