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

[GENERAL] How to get variable out to shell script

2009-09-20 Thread Alex Gadea
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 completes execution. What I am trying to do is run the count

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 alex.ga...@apptik.com 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

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 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 just

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

2009-09-20 Thread Alex Gadea
: 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 variable available

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 alex.ga...@apptik.com 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

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 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 sql