Re: BUG #17736: when psql -c is used, the $ sign is escaped

From: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
To: dafoer_x(at)163(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17736: when psql -c is used, the $ sign is escaped
Date: 2023-01-04 13:34:23
Message-ID: CAFBsxsGGKROx00dp7g2W_7hCsxoFnz9ezU09ZFB8L61WGb9v1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Jan 4, 2023 at 5:00 PM PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:
> Because $ is escaped, the results are different when the same command is
> executed in psql and internally.
> I would like to ask how to solve this problem, or why there is this
> difference?

When passing a quoted argument to psql, it is necessary to account for the
shell's interpretation, for example:

$ echo "foo $1"
foo

$ echo "foo \$1"
foo $1

--
John Naylor
EDB: http://www.enterprisedb.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Sandeep Thakkar 2023-01-05 02:04:32 Re: BUG #17733: ERROR: could not load library "/Users/frank/postgres/postgresql-13.9/lib/postgresql/llvmjit.so": dl
Previous Message PG Bug reporting form 2023-01-04 02:48:28 BUG #17736: when psql -c is used, the $ sign is escaped