[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [here string] uncompatible change on here string function
From: |
Chet Ramey |
Subject: |
Re: [here string] uncompatible change on here string function |
Date: |
Wed, 22 Nov 2017 21:05:51 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 11/22/17 8:17 PM, PePa wrote:
> On 11/23/2017 02:23 AM, Chet Ramey wrote:
>> The bash-4.2 man page defers the description of here strings to the
>> description of here documents. The lines in a here document do not undergo
>> word splitting. It was a bug in bash-4.2 that the WORD in a here string
>> was split.
>>
>> This finally got fixed in bash-4.4, as described by this CHANGES entry:
>>
>> z. Bash no longer splits the expansion of here-strings, as the
>> documentation
>> has always said.
>
> I would think it is useful (and according to how things work in general) to
> have a different behavior for <<<"$a" and <<<$a
>
> If one wants to have all line-breaks, spaces and tabs preserved, use
> <<<"$a" otherwise use <<<$a
Here strings are, as the documentation says, a variant of here documents.
There should be no behavioral difference between
v=$'abc\tdef'
cat <<EOF
$v
EOF
and
cat <<<$v
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
Message not available