| From: | Margarita Barvinok <brita(at)umich(dot)edu> | 
|---|---|
| To: | DalTech - Continuing Technical Education <CTE(at)Dal(dot)Ca> | 
| Cc: | pgsql-sql(at)postgresql(dot)org | 
| Subject: | Re: Running queries from scripts. | 
| Date: | 2000-07-06 15:58:00 | 
| Message-ID: | Pine.SOL.4.10.10007061156260.29747-100000@tempest.gpcc.itd.umich.edu | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
Hi,
It works for me, for example, this way:
athens% psql -d template1 -c "select datname from pg_database"
  datname  
-----------
 template1
 postgres
 biology
 test
(4 rows)
 
Hope this helps,
-Rita
On Thu, 6 Jul 2000, DalTech - Continuing Technical Education wrote:
> I was wondering if anyone could help me out with the syntax of running queries from a unix script.
> 
> psql -c select 'I am a dummy' -d dbname  - never seems to work.  I've tried variations on the command line, but to no success.
> 
> Does the -c option work?
> 
> Cheers,
> Christopher Currie
> 
> __________________________________
> Dalhousie: DalTech - CTE
> Visit our Web site at http://www.cte.dal.ca
> (902) 494-6079
> (800) 565-1179
> 
--------------------------------------------------------
Margarita Barvinok                University of Michigan
System Administrator II           Department of Biology
brita(at)umich(dot)edu
---------------------------------------------------------
| From | Date | Subject | |
|---|---|---|---|
| Next Message | DalTech - Continuing Technical Education | 2000-07-06 16:16:16 | Re: Running queries from scripts. | 
| Previous Message | DalTech - Continuing Technical Education | 2000-07-06 15:50:23 | Running queries from scripts. |