bug-bash
[Top][All Lists]
Advanced

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

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}

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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