bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trailing newlines disappear


From: Eduardo Bustamante
Subject: Re: Trailing newlines disappear
Date: Thu, 8 Jun 2017 17:26:00 -0500

On Thu, Jun 8, 2017 at 3:56 PM, Greg Wooledge <wooledg@eeg.ccf.org> wrote:
> On Thu, Jun 08, 2017 at 10:44:29PM +0200, Geir Hauge wrote:
>> You can pick one of these instead:
>>
>>     mapfile < "$file"; IFS= foo="${MAPFILE[*]}"; unset -v IFS
>>
>> or
>>
>>     mapfile < "$file"; printf -v foo %s "${MAPFILE[@]}"
>
> or
>
>     lambda() { local MAPFILE IFS=; mapfile < "$file"; foo="${MAPFILE[*]}"; }
>     lambda
>

What's wrong with:

IFS= read -rd '' foo < "$file"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]