In my bash testthere is a relation to exit with status 0:
$ test -n && echo true || echo false
-> true
and
$ test -n "" && echo true || echo false
-> false
This means that if it takes no arguments at all, it takes a nonzero value.
The case -zworks correctly:
$ test -z && echo true || echo false
-> true
$ test -z "" && echo true || echo false
-> true
Is this the expected behavior?
source
share