Starting psql from Script - how to pass the password?

From: Dani Oderbolz <oderbolz(at)ecologic(dot)de>
To: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Starting psql from Script - how to pass the password?
Date: 2003-06-20 11:22:50
Message-ID: 3EF2EE8A.70700@ecologic.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi all,
I am sure, this has been answerde over and over again,
but I did not find anything in the list-Archives.

I would like to run psql from a script, using a user that requires
a password (I know that I could change pg_hba.conf, but thats not what I
want).
Now, psql doesn't seem to take the password as an option,right?

I tried this:

/usr/local/pgsql/bin/psql -d "$DB" -U "$USER" -o "$OFILE" -q -c "$SQL"
-F "$SEPARATOR" -t <<EOT "$PASS"
EOT

Where $PASS stores my password.
But still, psql prompts me for the password...

Is there a way around this?

Thanks,
Dani

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Hubert Lubaczewski 2003-06-20 12:22:04 Re: Starting psql from Script - how to pass the password?
Previous Message paul butler 2003-06-20 09:24:43 Re: Help regarding INSERT INTO statement