Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[BUG] test ! "-o" ([ ! -o ]) exit status should be 1
- X-seq: zsh-workers 49267
- From: koichi nakashima <koichi@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [BUG] test ! "-o" ([ ! -o ]) exit status should be 1
- Date: Mon, 9 Aug 2021 19:55:28 +0900
- Archived-at: <https://zsh.org/workers/49267>
- List-id: <zsh-workers.zsh.org>
In the following code, I expected the exit status to be 1.
However, in zsh 5.0.3 and later, it was actually 0.
$ zsh -c '[ ! -o ]; echo "$ZSH_VERSION: $?"'
4.3.17: 1
$ zsh -c '[ ! -o ]; echo "$ZSH_VERSION: $?"'
5.0.0: 1
$ zsh -c '[ ! -o ]; echo "$ZSH_VERSION: $?"'
5.0.2: 1
$ zsh -c '[ ! -o ]; echo "$ZSH_VERSION: $?"' # <===
5.0.3: 0
$ zsh -c '[ ! -o ]; echo "$ZSH_VERSION: $?"'
5.8: 0
I checked the release notes, and it does not appear to be
an intentional change.
In other latest shells, it is as expected.
$ dash -c '[ ! -o ]; echo $?'
1
$ bash -c '[ ! -o ]; echo $?'
1
$ ksh -c '[ ! -o ]; echo $?'
1
$ yash -c '[ ! -o ]; echo $?'
1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author