PostgreSQL sous Linux
Syntaxe : Exécuter une instruction PostgreSQL depuis Linux
Exemple : Exécuter un script PostgreSQL depuis Linux
CTRL+C pour copier, CTRL+V pour coller
1
2
psql -c "DROP DATABASE mydb"
3
psql -c "CREATE DATABASE mydb"
4
psql -c "GRANT ALL PRIVILEGES ON DATABASE mydb TO user1"
#!/bin/sh psql -c "DROP DATABASE mydb" psql -c "CREATE DATABASE mydb" psql -c "GRANT ALL PRIVILEGES ON DATABASE mydb TO user1"
Complément : psql : exécuter une commande Linux
\!
: permet d'exécuter certaines commandes du shell Linux depuis le client psql.