Skip to content

Instantly share code, notes, and snippets.

@Justman100
Created November 24, 2024 14:29
Show Gist options
  • Save Justman100/bf060bc4ab5f1da3e99e111fa593b257 to your computer and use it in GitHub Desktop.
Save Justman100/bf060bc4ab5f1da3e99e111fa593b257 to your computer and use it in GitHub Desktop.
Creates a database in MariaDB or PostgreSQL
#!/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