GNU bug report logs - #59612
29.0.50; Eshell: The behavior of conditionals depends on whitespace

Previous Next

Package: emacs;

Reported by: Milan Zimmermann <milan.zimmermann <at> gmail.com>

Date: Sat, 26 Nov 2022 15:54:02 UTC

Severity: normal

Found in version 29.0.50

Full log


Message #14 received at 59612 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Milan Zimmermann <milan.zimmermann <at> gmail.com>, 59612 <at> debbugs.gnu.org
Subject: Re: bug#59612: Incorrect behavior also with ${CONDITION}
Date: Sat, 26 Nov 2022 10:28:20 -0800
On 11/26/2022 8:19 AM, Milan Zimmermann wrote:
> I should add that I realized using {CONDITION} alone is not a reasonable 
> thing in my examples, as it uses exist status.
> 
> In a real code, one would use  ${CONDITION}. The modified script is 
> attached below #####. However, the behavior is still not as expected:

In this case, they should actually be the same thing. When the command 
in question is a Lisp function, a nil result sets the exit status to 2. 
This doesn't hold for external commands though; the output and the exit 
status are independent of one another. In that case, you'd want to spell 
it like so:

  if {[ 2 -eq 2 ]} { echo "good" }

So in conclusion, I think it's better to prefer {CONDITION} for 'if' forms.




This bug report was last modified 2 years and 246 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.