public inbox for [email protected]
help / color / mirror / Atom feedFrom: Bruce Momjian <[email protected]>
To: Simon Riggs <[email protected]>
Cc: [email protected]
Subject: Re: psql man page error?
Date: Tue, 5 Dec 2006 12:41:00 -0500 (EST)
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
Simon Riggs wrote:
>
> On the psql man page there is an example of how to perform multiple line
> psql script as part of the -c option description.
>
> The example given is
>
> echo "\x \\ select * from foo;" | psql
>
> which gives
>
> prompt> echo "\x \\ select * from foo;" | psql
> Expanded display is on.
> invalid command \
>
> i.e. doesn't work on bash. With bash the command should be:
>
> echo -e "\x \n select * from foo;" | psql
>
> which gives
>
> prompt> echo -e "\x \n select * from foo;" | psql
> Expanded display is on.
> ERROR: relation "foo" does not exist
>
> Does this mean there are multiple forms of the echo command, or is this
> example just wrong?
Intersting. This example has been around since at least 2002. The SGML
looks like this:
<application>psql</application>, like this: <literal>echo "\x \\
select * from foo;" | psql</literal>.
and I suppose the asumption was that the \\ would be at the end of the
output line, but in fact both HTML and manual pages just put the \\
anywhere on the line. I think the proper fix is:
<application>psql</application>, like this: <literal>echo -e
"\\x\nSELECT * FROM foo;" | psql</literal>.
I think all modern operating systems understand echo -e at this point.
Change applied to HEAD and 8.2.X.
--
Bruce Momjian [email protected]
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
view thread (17+ messages) latest in thread
reply
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: psql man page error?
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox