Op 25-09-16 om 22:40 schreef isabella parakiss: > On 9/25/16, Martijn Dekker <mart...@inlv.org> wrote: >> 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. [...] > [ ! -o noclobber ] means > is '!' a non empty string? if not, is 'noclobber' a non empty string?
Wow. Yeah, I suppose that's one possible interpretation. I was going for the POSIX one: | These primaries can be combined with the following operators: | | ! expression | True if expression is false. False if expression is true. Ref: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128 And indeed your interpretation does not apply to something like "[ ! -e /tmp ]": $ [ -e /tmp ]; echo $? 0 $ [ ! -e /tmp ]; echo $? 1 However, the supposed synonym -a acts differently: $ [ -a /tmp ]; echo $? 0 $ [ ! -a /tmp ]; echo $? 0 Well, one more entry in the long list of arguments to avoid test/[... Thanks, - M.