zsh-workers
 help / color / mirror / code / Atom feed
* behavior of test true -a \( ! -a \)
@ 2024-03-21 10:07 Vincent Lefevre
  2024-03-21 10:28 ` Peter Stephenson
  2024-03-21 17:39 ` Bart Schaefer
  0 siblings, 2 replies; 22+ messages in thread
From: Vincent Lefevre @ 2024-03-21 10:07 UTC (permalink / raw)
  To: zsh-workers

I know that the "test" utility (builtin in zsh) is ambiguous,
is not completely specified by POSIX and should not be used,
but IMHO, it should behave in a sensible and consistent way.

The following with zsh 5.9 is inconsistent:

qaa% test \( ! -a \) ; echo $?
1
qaa% test true -a \( ! -a \) ; echo $?
test: argument expected
2

In the second case, one should just get 1, like in the first case.

In 2008, I had noted at

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=421591#25

that zsh was returning 1 as expected. So it seems that this has
changed. This bug is about bash giving an error (like zsh now),
but note that with ash (BusyBox v1.36.1 sh), dash 0.5.12 and the
"test" command from the GNU coreutils 9.4, one gets 1 in these
two cases.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-04-03 13:59 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-21 10:07 behavior of test true -a \( ! -a \) Vincent Lefevre
2024-03-21 10:28 ` Peter Stephenson
2024-03-21 11:04   ` Vincent Lefevre
2024-03-21 11:29     ` Peter Stephenson
2024-03-21 12:18       ` Vincent Lefevre
2024-03-21 12:25         ` Peter Stephenson
2024-03-21 19:06           ` Bart Schaefer
2024-03-22  5:02             ` Bart Schaefer
2024-03-25 16:38       ` Peter Stephenson
2024-03-25 17:36         ` Bart Schaefer
2024-04-03 13:59           ` Vincent Lefevre
2024-03-21 17:39 ` Bart Schaefer
2024-03-23 21:48   ` Bart Schaefer
2024-03-23 22:20     ` Vincent Lefevre
2024-03-23 22:41       ` Bart Schaefer
2024-03-23 23:33         ` Lawrence Velázquez
2024-03-24  0:14           ` Bart Schaefer
2024-03-24  2:52             ` Lawrence Velázquez
2024-03-25 10:23         ` Vincent Lefevre
2024-03-25 15:21           ` Bart Schaefer
2024-03-25 17:33             ` Vincent Lefevre
2024-03-25 17:43               ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).