X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2054FD1B49C for ; Tue, 30 Dec 2003 10:08:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 75777-06 for ; Tue, 30 Dec 2003 06:07:29 -0400 (AST) Received: from mailgate.quelltext.com (mailgate.quelltext.com [212.46.119.68]) by svr1.postgresql.org (Postfix) with SMTP id 19639D1B45B for ; Tue, 30 Dec 2003 06:07:26 -0400 (AST) Received: (qmail 27465 invoked from network); 30 Dec 2003 10:07:12 -0000 Received: from unknown (HELO mail1.quelltext.com) (212.46.119.157) by mailgate.quelltext.com with SMTP; 30 Dec 2003 10:07:12 -0000 Received: (qmail 6518 invoked from network); 30 Dec 2003 10:07:11 -0000 Received: from unknown (HELO entoron.wiedau.de) (212.46.119.210) by digda.intern.quelltext.com with SMTP; 30 Dec 2003 10:07:11 -0000 Received: (qmail 3875 invoked by uid 10013); 30 Dec 2003 10:07:09 -0000 Date: Tue, 30 Dec 2003 11:07:09 +0100 From: Hans Peter Wiedau To: pgsql-admin@postgresql.org Subject: Re: How to use psql -c? Message-ID: <20031230100709.GA1937@entoron.wiedau.de> References: <20031229140613.A20733@quality.qadas.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/336 X-Sequence-Number: 11842 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" cu, Hans Peter -- ///// Quelltext AG -- Professional Software Services // // Hans Peter Wiedau , CEO // // Ostenhellweg 31, 44135 Dortmund, Germany // \\/ fon +49 231 9503750, fax +49 231 9503751 ////\\ Web http://www.quelltext.com