From: | Scott Whitney <scott(at)journyx(dot)com> |
---|---|
To: | "Ferrell, Denise D CTR NSWCDD, H11" <denise(dot)ferrell(dot)ctr(at)navy(dot)mil>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: Passing parameters |
Date: | 2016-03-22 15:01:03 |
Message-ID: | BY1PR11MB039067AB778E61E500795926A7800@BY1PR11MB0390.namprd11.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
What's wrong with doing it like this, for example?
#!/bin/bash
user=$1
database=$2
table=$3
myfield=$4
logfile=$5
mysql="select $4 from $3;"
psql -U $user $database -c "mysql" -l "$5"
Then:
/tmp/myscript postgres mydb mytable myfield /tmp/mylog
________________________________________
From: pgsql-admin-owner(at)postgresql(dot)org <pgsql-admin-owner(at)postgresql(dot)org> on behalf of Ferrell, Denise D CTR NSWCDD, H11 <denise(dot)ferrell(dot)ctr(at)navy(dot)mil>
Sent: Tuesday, March 22, 2016 9:44 AM
To: pgsql-admin(at)postgresql(dot)org
Subject: [ADMIN] Passing parameters
Hi All,
Using PostgreSQL v9.3 on Linux Red Hat...
I've got a script that I'm running from the Linux command prompt that I need to pass 2 parameter's into the psql script without using the VI Editor. Is there an easy way to accomplish this?
psql <database> -f <scriptname> -l <log_file>
Thank you in advance.
Denise
Journyx, Inc.
7600 Burnet Road #300
Austin, TX 78757
www.journyx.com
p 512.834.8888
f 512-834-8858
Do you receive our promotional emails? You can subscribe or unsubscribe to those emails at http://go.journyx.com/emailPreference/e/4932/714/
From | Date | Subject | |
---|---|---|---|
Next Message | John DeSoi | 2016-03-22 15:07:21 | Re: Passing parameters |
Previous Message | Stephen Frost | 2016-03-22 14:58:34 | Re: Passing parameters |