-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 4/14/2009 7:09 PM:
>>> $ zsh -c 'emulate sh; false; $empty; echo $?'
>>> 1
>> Present in zsh 4.3.6, not present in zsh 4.3.4, BTW.
> 
> I'm still trying to figure out where best to document this in the manual.

Done as follows:

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkoKvJMACgkQ84KuGfSFAYA02wCfXJTQd8eP097u6KZw8D+IJUkt
CX8AnRUzCekqSGbz8/XuEy7mVd/s1wIY
=kBXt
-----END PGP SIGNATURE-----
>From 780a068d297868cf3dd617ef12676cbfc3a05862 Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Mon, 4 May 2009 10:30:16 -0600
Subject: [PATCH] Document zsh bug with empty commands.

* doc/autoconf.texi (Special Shell Variables) <?>: Add mention of
more problems with $?.
---
 ChangeLog         |    6 ++++++
 doc/autoconf.texi |   15 +++++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e6e8892..88f4171 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-05-13  Eric Blake  <[email protected]>
+
+       Document zsh bug with empty commands.
+       * doc/autoconf.texi (Special Shell Variables) <?>: Add mention of
+       more problems with $?.
+
 2009-05-11  Patrick Welche  <[email protected]>  (tiny change)

        Also try X11R7 when looking for X11 files, for NetBSD.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index a4bb429..928b417 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -14925,6 +14925,20 @@ Special Shell Variables

 @c Alphabetical order, case insensitive, `A' before `a'.
 @table @code
+...@item ?
+Not all shells correctly reset @samp{$?} after conditionals (@pxref{if,
+, Limitations of Shell Builtins}).  Not all shells manage @samp{$?}
+correctly in shell functions (@pxref{Shell Functions}) or in traps
+(@pxref{trap, , Limitations of Shell Builtins}).  Not all shells reset
+...@samp{$?} to zero after an empty command.
+
+...@example
+$ @kbd{bash -c 'false; $empty; echo $?'}
+0
+$ @kbd{zsh -c 'false; $empty; echo $?'}
+1
+...@end example
+
 @item _
 Many shells reserve @samp{$_} for various purposes, e.g., the name of
 the last command executed.
@@ -15850,6 +15864,7 @@ Limitations of Builtins
 item @samp{$@@}, for more.


+...@anchor{if}
 @item @command{if}
 @c ---------------
 @prindex @command{if}
-- 
1.6.3.rc3.2.g4b51

Reply via email to