Re: ${p+\"$p\"}

2019-01-22 Thread Robert Elz
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

Re: ${p+\"$p\"}

2019-01-22 Thread Eric Blake
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

Re: ${p+\"$p\"}

2019-01-22 Thread 積丹尼 Dan Jacobson
OK so bash is right and dash is wrong? So I should file a dash bug?

Re: ${p+\"$p\"}

2019-01-21 Thread Bize Ma
-- *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

Re: ${p+\"$p\"}

2019-01-21 Thread Bize Ma
*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.

Re: ${p+\"$p\"}

2019-01-21 Thread don fong
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

Re: ${p+\"$p\"}

2019-01-21 Thread Chet Ramey
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

Re: ${p+\"$p\"}

2019-01-21 Thread Robert Elz
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

Re: ${p+\"$p\"}

2019-01-21 Thread Chet Ramey
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.

Re: ${p+\"$p\"}

2019-01-21 Thread Greg Wooledge
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"

${p+\"$p\"}

2019-01-21 Thread Dan Jacobson
So how am I to get "A" with bash? $ cat z p=A cat <