Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news2.arglkargh.de!news.glorb.com!usenet.stanford.edu!not-for-mail From: Linda Walsh Newsgroups: gnu.bash.bug 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 Lines: 22 Approved: bug-bash@gnu.org Message-ID: References: <55BE6FB8.4080200@tlinx.org> <55BE759D.8030700@gmail.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1438553489 15618 208.118.235.17 (2 Aug 2015 22:11:29 GMT) X-Complaints-To: action@cs.stanford.edu To: Charles Daffern , bug-bash Envelope-to: bug-bash@gnu.org User-Agent: Thunderbird In-Reply-To: <55BE759D.8030700@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 173.164.175.65 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11282 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!