[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[BUG] false positive: [ ! -o optname ]
From: |
Martijn Dekker |
Subject: |
[BUG] false positive: [ ! -o optname ] |
Date: |
Sun, 25 Sep 2016 22:32:04 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
The '!' operator in the legacy test/[ builtin does not invert the result
of the -o operator. Consequently the command
[ ! -o noclobber ]
amounts to a no-op, always returning exit status 0.
Proof:
$ set -o noclobber && [ -o noclobber ] && [ ! -o noclobber ] && echo bug
bug
Interestingly, mksh has this bug as well, though not the original pdksh.
Thanks,
- M.
- [BUG] false positive: [ ! -o optname ],
Martijn Dekker <=