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


Groups > gnu.bash.bug > #11281

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

From "Chris F.A. Johnson" <chris@cfajohnson.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 17:27 -0400
Message-ID <mailman.7769.1438550903.904.bug-bash@gnu.org> (permalink)
References <55BE6FB8.4080200@tlinx.org> <55BE7DD6.3040509@tlinx.org>

Show all headers | View raw


On Sun, 2 Aug 2015, Linda Walsh wrote:

>
> also noticed this similar strange behavior:
>
> used 'ord'** for this test (trying to compare decimal val of chars)
>
> isatty () { test -c /proc/self/fd/1 ; }
> ord () { local nl=""; isatty && nl="\n"; printf "%d$nl" "'$1" ; } ord () { local nl=""; isatty && nl="\n"; printf "%d$nl" "'$1" ; } 
>> ord "$(printf "\n")"

    Trailing newline are stripped from command substitution, making "$(printf "\n")" and empty string.

    If you want a newline, use:

ord $'\n'

-- 
Chris F.A. Johnson, <http://cfajohnson.com>

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) "Chris F.A. Johnson" <chris@cfajohnson.com> - 2015-08-02 17:27 -0400

csiph-web