4 ms·
There are a few misfeatures in `test`, though. For instance, one way to use it is test somestring to test if "somestring" is empty. POSIX mandates that te
by faho 8y ago
There are a few misfeatures in `test`, though.
For instance, one way to use it is
test somestring
to test if "somestring" is empty. POSIX mandates that test with exactly one argument succeeds iff that argument is a non-empty string, to allow that. Fish's test is POSIX-conformant.
Now, that means that
test -n
is true! Which is also triggered for
test -n $var
if $var has 0 elements.
This is a problem and should be improved.
- CameronNemo 8y agoalways quote your variables. POSIX won't change this soon, or likely ever.