Skip site navigation (1) Skip section navigation (2)

psql Automatic login In Bash Script

From: Sai Hertz And Control Systems <sank89(at)sancharnet(dot)in>
To: pgsql-admin(at)postgresql(dot)org
Subject: psql Automatic login In Bash Script
Date: 2004-01-13 19:47:41
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
Dear all ,

I know this is a wrong list to for this post


We use bash script for database maintainace and  implimenting new  
schema in the production database
the script goes as
until [ "$uname" ]
read -s uname
until [ "$pass"  ]
read -s pass
psql -U $uname mydatabase -f  ./my_functions.sql
psql -U $uname mydatabase -f  ./my_tables.sql
psql -U $uname mydatabase -f  ./my_views.sql
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
and my database migration would go smothly

Also would not like to set ~/.pgpass

Would be greateful  to you all  for any kinda help .

Vishal Kashyap


pgsql-admin by date

Next:From: Sai Hertz And Control SystemsDate: 2004-01-13 20:00:40
Subject: Re: psql Automatic login In Bash Script
Previous:From: Peter EisentrautDate: 2004-01-13 19:47:28
Subject: Re: psql Automatic login In Bash Script

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group