pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sai Hertz And Control Systems <sank89@sancharnet.in>
To: pgsql-admin@postgresql.org
Subject: psql  Automatic login In Bash Script
Date: Wed, 14 Jan 2004 01:17:41 +0530
Message-ID: <40044B5D.9040909@sancharnet.in> (raw)

Dear all ,

I know this is a wrong list to for this post

Anyways

We use bash script for database maintainace and  implimenting new  
schema in the production database
the script goes as
<code>
#!/bin/sh
until [ "$uname" ]
do
read -s uname
done
until [ "$pass"  ]
do
read -s pass
done
psql -U $uname mydatabase -f  ./my_functions.sql
psql -U $uname mydatabase -f  ./my_tables.sql
psql -U $uname mydatabase -f  ./my_views.sql
</code>
The problem is psql has no option  such that I can pass on the variable 
$pass for password 
and as you can see I have to type in  password three times  (in real 
case 10 times)

What I need is since password be stored in the bash variable for  once I 
may pass on the variable with password to
psql
pg_dump
pg_restore
and my database migration would go smothly

Also would not like to set ~/.pgpass

Would be greateful  to you all  for any kinda help .


Regards,
Vishal Kashyap



view thread (5+ messages)  latest in thread

Message-ID: <40044B5D.9040909@sancharnet.in>
Permalink:  ../40044B5D.9040909@sancharnet.in/
Also on:    postgresql.org/message-id/40044B5D.9040909@sancharnet.in

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: sank89@sancharnet.in
  Subject: Re: psql  Automatic login In Bash Script
  In-Reply-To: <40044B5D.9040909@sancharnet.in>
  References: <40044B5D.9040909@sancharnet.in>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox