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>