Guest User

Untitled

a guest
Aug 22nd, 2019
119
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. username=ignacio
  4. password=ignacio
  5. dbname=AAA
  6.  
  7. create_db="'CREATE DATABASE \"$dbname\";'"
  8.  
  9. grant_all_privileges="'GRANT ALL PRIVILEGES ON DATABASE \"${dbname}\" TO ${username};'"
  10.  
  11. create_user="'CREATE USER ${username} WITH PASSWORD '\''${password}'\'';'"
  12.  
  13.  
  14. sudo su postgres -c "psql -c $create_db"
  15.  
  16. sudo su postgres -c "psql -c $create_user"
  17.  
  18. sudo su postgres -c "psql -c $grant_all_privileges"
RAW Paste Data