From: Charles Haron <charles.haron@cognitive.com>
To: pgsql-admin@postgresql.org
Subject: Re: How to use psql -c?
Date: Tue, 30 Dec 2003 10:28:38 -0700
Message-ID: <9ABC61DA-3AED-11D8-9F29-000A95AA0B44@cognitive.com> (raw)
In-Reply-To: <20031230100709.GA1937@entoron.wiedau.de>
References: <20031229140613.A20733@quality.qadas.com>
<BC15ECC5.856%charles.haron@cognitive.com>
<20031230100709.GA1937@entoron.wiedau.de>
On Dec 30, 2003, at 3:07 AM, Hans Peter Wiedau wrote:
> On Mon, Dec 29, 2003 at 02:37:57PM -0700, Charles Haron wrote:
>
>> The following command works as I want:
>> psql -c "DELETE FROM prg_dates_members WHERE confirm = 'f';" comfire
>>
>> I want to be able to run the above command as a cron job. I created a
>> script with the following command, but I get "ERROR: Attribute 'f'
>> not
>> found":
>> su - postgres -c 'psql -c "DELETE FROM prg_dates_members WHERE
>> confirm =
>> 'f';" comfire'
>>
>> What am I doing wrong? Is there a better way to do this?
>
> The bash manual page says:
>
> A single quote may not occur between single quotes, even when
> preceded by a backslash.
>
> So, try this one:
>
> su - postgres -c "psql -c \"DELETE FROM prg_dates_members WHERE
> confirm = 'f'\" comfire"
>
It works perfectly! Thank you very much.
Chuck
> cu,
>
> Hans Peter
>
> --
> ///// Quelltext AG -- Professional Software Services
> // // Hans Peter Wiedau <hpw-nl@quelltext.com>, CEO
> // // Ostenhellweg 31, 44135 Dortmund, Germany
> // \\/ fon +49 231 9503750, fax +49 231 9503751
> ////\\ Web http://www.quelltext.com
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 8: explain analyze is your friend
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: charles.haron@cognitive.com
Subject: Re: How to use psql -c?
In-Reply-To: <9ABC61DA-3AED-11D8-9F29-000A95AA0B44@cognitive.com>
References: <20031229140613.A20733@quality.qadas.com> <BC15ECC5.856%charles.haron@cognitive.com> <20031230100709.GA1937@entoron.wiedau.de> <9ABC61DA-3AED-11D8-9F29-000A95AA0B44@cognitive.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox