1 |
>>>>> On Sat, 19 Dec 2015, Michał Górny wrote: |
2 |
|
3 |
> read -d '' -r -a DOC_CONTENTS <<<"${DOC_CONTENTS}" |
4 |
|
5 |
> This performs word splitting into an array. Then you can do: |
6 |
|
7 |
> echo -e "${DOC_CONTENTS[*]}" | ... |
8 |
|
9 |
The first line fails for me: |
10 |
|
11 |
$ DOC_CONTENTS="test" |
12 |
$ read -d '' -r -a DOC_CONTENTS <<<"${DOC_CONTENTS}" |
13 |
$ echo $? |
14 |
1 |
15 |
|
16 |
(I guess it is encountering EOF on the temporary file created by the |
17 |
string redirection, but how would one distinguish this from other |
18 |
errors?) |
19 |
|
20 |
Besides, it is hard to understand what this code does, as compared to |
21 |
the "set -f" solution. |
22 |
|
23 |
Ulrich |