Add more test examples, including expression negation

Closes #4383
This commit is contained in:
Mahmoud Al-Qudsi 2017-10-08 02:06:48 +02:00
parent b61c4f1cbc
commit ff66d2f3c1

View file

@ -139,6 +139,22 @@ if test $status -eq 0
end end
\endfish \endfish
The previous test can likewise be inverted:
\fish
if test ! $status -eq 0
echo "Previous command failed"
end
\endfish
which is logically equivalent to the following:
\fish
if test $status -ne 0
echo "Previous command failed"
end
\endfish
\subsection test-standards Standards \subsection test-standards Standards
`test` implements a subset of the <a href="http://www.unix.com/man-page/POSIX/1/test/">IEEE Std 1003.1-2008 (POSIX.1) standard</a>. The following exceptions apply: `test` implements a subset of the <a href="http://www.unix.com/man-page/POSIX/1/test/">IEEE Std 1003.1-2008 (POSIX.1) standard</a>. The following exceptions apply: