Date:Tue, 22 Jan 2019 20:23:50 -0600
From:Eric Blake
Message-ID: <77d63ba1-64ba-c0a8-7d32-9d8cc3289...@redhat.com>
| Rather, POSIX says the behavior is undefined,
That's what it is going to say, when Issue 8 is published, some
years into the future (how many, anyon
On 1/22/19 6:36 PM, 積丹尼 Dan Jacobson wrote:
> OK so bash is right and dash is wrong? So I should file a dash bug?
Rather, POSIX says the behavior is undefined, so both shells are right,
and you cannot portably use " inside ${p+...} when in a double-quoted
context (such as a heredoc).
For more det
OK so bash is right and dash is wrong? So I should file a dash bug?
--
*From*: Robert Elz
*Subject*: Re: ${p+\"$p\"}
*Date*: Mon, 21 Jan 2019 23:38:22 +0700
--
(...)
> With the quotes, most other shells produce the output reported
> from dash (that includes ksh93, yash, ...) zsh just says
*From*: Dan Jacobson
*Subject*: ${p+\"$p\"}
*Date*: Mon, 21 Jan 2019 21:14:26 +0800
--
So how am I to get
"A"
with bash?
How about:
#!/bin/bash
p=A
q='"'
cat <<_EOF_
${p+$q$p$q}
_EOF_
Works on all shells I tested it.
here is another possible workaround, apologies if this has already been
mentioned.
cat < wrote:
> On Mon, Jan 21, 2019 at 09:14:26PM +0800, Dan Jacobson wrote:
> > So how am I to get
> > "A"
> > with bash?
> >
> > $ cat z
> > p=A
> > cat
On 1/21/19 11:38 AM, Robert Elz wrote:
> Date:Mon, 21 Jan 2019 09:37:02 -0500
> From:Chet Ramey
> Message-ID:
>
> | It's the here-document. Backslashes and double quotes in here documents
> are
> | kind of strange. This is historical sh behavior.
>
> Not so muc
Date:Mon, 21 Jan 2019 09:37:02 -0500
From:Chet Ramey
Message-ID:
| It's the here-document. Backslashes and double quotes in here documents are
| kind of strange. This is historical sh behavior.
Not so much backslashes, a here doc (this form) is just a double
quo
On 1/21/19 8:14 AM, Dan Jacobson wrote:
> So how am I to get
> "A"
> with bash?
echo ${p+\"$p\"}
> $ cat z
> p=A
> cat < ${p+\"$p\"}
> ${p+"$p"}
> EOF
> $ bash z
> \"A\"
> A
It's the here-document.
On Mon, Jan 21, 2019 at 09:14:26PM +0800, Dan Jacobson wrote:
> So how am I to get
> "A"
> with bash?
>
> $ cat z
> p=A
> cat < ${p+\"$p\"}
> ${p+"$p"}
> EOF
> $ bash z
> \"A\"
> A
> $ dash z
> "A"
So how am I to get
"A"
with bash?
$ cat z
p=A
cat <
11 matches
Mail list logo