Re: How to get variable out to shell script

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Alex Gadea <alex(dot)gadea(at)apptik(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to get variable out to shell script
Date: 2009-09-20 22:10:10
Message-ID: dcc563d10909201510x602f7676w6a74df65cdfebf09@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Sep 20, 2009 at 3:49 PM, Alex Gadea <alex(dot)gadea(at)apptik(dot)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 external sql file completes execution.  What I am trying to do is
> run the count command against a table in two different databases on two
> different servers and then compare the variables.
>
> Any ideas?

$x=`psql -At -c "select b from a limit 1;"`
$ echo $x
test

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GÜNDÜZ 2009-09-20 22:10:43 Re: How to get variable out to shell script
Previous Message Alex Gadea 2009-09-20 21:49:03 How to get variable out to shell script