|
From: | Linda Walsh |
Subject: | Re: BUG?: (or what's going on?) test for NL == NL fails (bash-4.3.39(3)-release) |
Date: | Sun, 02 Aug 2015 15:11:17 -0700 |
User-agent: | Thunderbird |
Charles Daffern wrote:
On 02/08/15 20:30, Linda Walsh wrote:if [[ $(printf "\n") == $'\n' ]]; then echo T; else echo F; fiFThe 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}
---- I see what you mean --- erk... I think the process substitution doesn't, since you need to explicitly use a -t switch if you want to strip the "\n"'s off Thanks!
[Prev in Thread] | Current Thread | [Next in Thread] |