Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
behavior of test true -a \( ! -a \)
- X-seq: zsh-workers 52788
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: behavior of test true -a \( ! -a \)
- Date: Thu, 21 Mar 2024 11:07:10 +0100
- Archived-at: <https://zsh.org/workers/52788>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
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@xxxxxxxxxx> - 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)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author