Created
November 24, 2024 14:29
-
-
Save Justman100/bf060bc4ab5f1da3e99e111fa593b257 to your computer and use it in GitHub Desktop.
Creates a database in MariaDB or PostgreSQL
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 | |
case $1 in | |
-m|--mysql|--mariadb) | |
db_type=mariadb | |
;; | |
-p|--psql|--postgresql) | |
db_type=psql | |
;; | |
*) | |
echo "Unknown arg" | |
exit 1 | |
;; | |
esac | |
$db_type << EOF | |
DROP DATABASE IF EXISTS $2; | |
CREATE DATABASE $2; | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment