all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Milan Zimmermann <milan.zimmermann@gmail.com>, 59612@debbugs.gnu.org
Subject: bug#59612: Incorrect behavior also with ${CONDITION}
Date: Sat, 26 Nov 2022 10:28:20 -0800	[thread overview]
Message-ID: <860fa3d1-f8e5-68db-b82b-55a6991d10fc@gmail.com> (raw)
In-Reply-To: <CAEc2VK01OXUCDM05RsXhJpL4RqaE1N+yBjARib_fYD-SkGfykQ@mail.gmail.com>

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.





  reply	other threads:[~2022-11-26 18:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-26 15:52 bug#59612: 29.0.50; Eshell: The behavior of conditionals depends on whitespace Milan Zimmermann
2022-11-26 15:59 ` bug#59612: A comment line in example change Milan Zimmermann
2022-11-26 16:19 ` bug#59612: Incorrect behavior also with ${CONDITION} Milan Zimmermann
2022-11-26 18:28   ` Jim Porter [this message]
2022-11-26 19:32     ` Jim Porter
2022-11-26 18:42 ` bug#59612: 29.0.50; Eshell: The behavior of conditionals depends on whitespace Jim Porter
2022-11-27  0:39   ` Jim Porter
2022-11-27  2:16   ` Milan Zimmermann
2022-11-27  3:13     ` Jim Porter
2022-11-27  5:07       ` Milan Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=860fa3d1-f8e5-68db-b82b-55a6991d10fc@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=59612@debbugs.gnu.org \
    --cc=milan.zimmermann@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.