bug-bash
[Top][All Lists]
Advanced

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

Re: Trailing newlines disappear


From: Geir Hauge
Subject: Re: Trailing newlines disappear
Date: Thu, 8 Jun 2017 22:44:29 +0200
User-agent: NeoMutt/20161126 (1.7.1)

On Fri, Jun 09, 2017 at 03:34:39AM +0700, PePa wrote:
> On 09/06/2560 02:14, Greg Wooledge wrote:
> > Well, it leaves IFS changed, because you didn't revert or unset it,
> > or run the entire thing in a function with local IFS.  Also, I'd use
> > "${MAPFILE[*]}" to reinforce that you are joining an array into a string,
> > rather than expanding the array as a list.
> 
> Thanks for pointing all this out. I settled on:
> mapfile <"$file"; IFS= foo=${MAPFILE[*]} true

Greg already pointed out that this doesn't work.

You can pick one of these instead:

    mapfile < "$file"; IFS= foo="${MAPFILE[*]}"; unset -v IFS

or

    mapfile < "$file"; printf -v foo %s "address@hidden"

-- 
Geir Hauge



reply via email to

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