On 09/06/2560 00:42, Greg Wooledge wrote:
> It's not a bug. This is how command substitution has worked since
> the original Bourne shell.
>
> The workaround is to put something inside the command substitution,
> so that the newlines aren't trailing any more, and then strip it away
> afterward:
>
> foo=$(cat "$file"; printf x) foo=${foo%x}
Thanks for the reply.
Seeing the hackish workaround, I would call it an ossified (or codified)
flaw...
The workaround I came up with is:
mapfile <"$file"; IFS= foo=${MAPFILE[@]}
This seems to be faster, but it probably has other disadvantages...
Peter