Re: [GENERAL] How to get variable out to shell script

2009-09-23 Thread Greg Smith
On Sun, 20 Sep 2009, Abel Camarillo wrote: #!/bin/sh dbname= user= password= In general it's better to use the .pgpass/PGPASSFILE mechanism: http://www.postgresql.org/docs/current/static/libpq-pgpass.html to cache passwords like this, if you can't eliminate the need for them altogether thro

Re: [GENERAL] How to get variable out to shell script

2009-09-20 Thread Abel Camarillo
On Sun, Sep 20, 2009 at 04:49:03PM -0500, Alex Gadea wrote: > I am using psql to call an external sql file that executes a simple select > count(*): > > ie: select into ct count(*) from table; > > I can't figure out how to make the ct variable available to the shell script > once the external

Re: [GENERAL] How to get variable out to shell script

2009-09-20 Thread Brent Wood
On Sun, 2009-09-20 at 16:49 -0500, Alex Gadea wrote: > I am using psql to call an external sql file that executes a simple > select count(*): > > ie: select into ct count(*) from table; > > I can't figure out how to make the ct variable available to the shell > script once the external sql file

Re: [GENERAL] How to get variable out to shell script

2009-09-20 Thread Scott Marlowe
On Sun, Sep 20, 2009 at 4:42 PM, Alex Gadea wrote: > Yes, I'd like to do it via Perl, but I don't have control over the server and > the admins who do may balk at the idea of loading the necessary db modules. Was in the same position as you. Only language allowed on our production dbs was bash.

Re: [GENERAL] How to get variable out to shell script

2009-09-20 Thread Alex Gadea
t: Sunday, September 20, 2009 6:21:05 PM GMT -05:00 US/Canada Eastern Subject: Re: [GENERAL] How to get variable out to shell script On Sun, Sep 20, 2009 at 04:49:03PM -0500, Alex Gadea wrote: > ie: select into ct count(*) from table; > > I can't figure out how to make the ct variab

Re: [GENERAL] How to get variable out to shell script

2009-09-20 Thread Sam Mason
On Sun, Sep 20, 2009 at 04:49:03PM -0500, Alex Gadea wrote: > ie: select into ct count(*) from table; > > I can't figure out how to make the ct variable available to the shell > script once the external sql file completes execution. Just tell psql not to output any surrounding stuff and then jus

Re: [GENERAL] How to get variable out to shell script

2009-09-20 Thread Devrim GÜNDÜZ
On Sun, 2009-09-20 at 16:49 -0500, Alex Gadea wrote: > I am using psql to call an external sql file that executes a simple > select count(*): > > ie: select into ct count(*) from table; > > I can't figure out how to make the ct variable available to the shell > script once the external sql file

Re: [GENERAL] How to get variable out to shell script

2009-09-20 Thread Scott Marlowe
On Sun, Sep 20, 2009 at 3:49 PM, Alex Gadea wrote: > I am using psql to call an external sql file that executes a simple select > count(*): > > ie: select into ct count(*) from table; > > I can't figure out how to make the ct variable available to the shell script > once the external sql file comp