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: Chris F.A. Johnson
Subject: Re: BUG?: (or what's going on?) test for NL == NL fails (bash-4.3.39(3)-release)
Date: Sun, 2 Aug 2015 17:27:55 -0400 (EDT)
User-agent: Alpine 2.10 (DEB 1266 2009-07-14)

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>



reply via email to

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