Charles Daffern wrote:
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}
----
        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!



Reply via email to