Re: BUG?: (or what's going on?) test for NL == NL fails (bash-4.3.39(3)-
From:
Charles Daffern
Subject:
Re: BUG?: (or what's going on?) test for NL == NL fails (bash-4.3.39(3)-release)
Date:
Sun, 2 Aug 2015 20:55:09 +0100
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1
On 02/08/15 20:30, Linda Walsh wrote:
>> if [[ $(printf "\n") == $'\n' ]]; then echo T; else echo F; fi
> F
The command substitution operators ($(...) and `...`) strip all trailing
linefeeds. You are left with an empty string here.
The usual workarounds I see (where necessary) are hacks like this:
variable=$(command; echo x); variable=${variable%?x}
signature.asc Description: OpenPGP digital signature