[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ${p+\"$p\"}
From: |
Chet Ramey |
Subject: |
Re: ${p+\"$p\"} |
Date: |
Mon, 21 Jan 2019 09:37:02 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 |
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 <<EOF
> ${p+\"$p\"}
> ${p+"$p"}
> EOF
> $ bash z
> \"A\"
> A
It's the here-document. Backslashes and double quotes in here documents are
kind of strange. This is historical sh behavior.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/