Running the PostgreSQL CLI (psql) through a bash script as user postgres causes a password prompt to be sent, even though I can run it manually without a password. When I t
You can use password file pgpass.conf or use PGPASSWORD variable.
For local development or if security isn't an issue, you could also configure PostgreSQL to run in trust authentication mode by modifying your pg_hba.conf
file.
You can, as long as you are OK with not having authentication for that specific user connecting from the host where script is running. For this, you just add the following line to pghba.conf
on your server (you will need to restart PostgreSQL daemon):
host YOUR_DB YOUR_USER YOUR_IP trust
Where:
Other option could be using expect utility (assuming you are using linux or some unix variant or shell such as cygwin).