Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11280

Re: BUG?: (or what's going on?) test for NL == NL fails (bash-4.3.39(3)-release)

From Charles Daffern <seejay.11@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: BUG?: (or what's going on?) test for NL == NL fails (bash-4.3.39(3)-release)
Date 2015-08-02 20:55 +0100
Message-ID <mailman.7764.1438545327.904.bug-bash@gnu.org> (permalink)
References <55BE6FB8.4080200@tlinx.org>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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}

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: BUG?: (or what's going on?) test for NL == NL fails (bash-4.3.39(3)-release) Charles Daffern <seejay.11@gmail.com> - 2015-08-02 20:55 +0100

csiph-web