mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-14 17:07:44 +00:00
43 lines
1.5 KiB
Text
43 lines
1.5 KiB
Text
\section test test - perform tests on files and text
|
|
|
|
\subsection test-synopsis Synopsis
|
|
<tt>test [EXPRESSION]</tt>
|
|
|
|
\subsection test-description Description
|
|
|
|
Tests the expression given and returns true or false.
|
|
|
|
- \c -h, \c Display this help
|
|
- \c -G, \c File owned by effective group ID
|
|
- \c -L, \c File is syslink
|
|
- \c -O, \c File owned by effective user ID
|
|
- \c -S, \c File is socket
|
|
- \c -a, \c Logical and
|
|
- \c -b, \c File is block device
|
|
- \c -c, \c File is character device
|
|
- \c -d, \c File is a directory
|
|
- \c -e, \c File exists
|
|
- \c -f, \c File is regular
|
|
- \c -f, \c File is set-group-ID
|
|
- \c -k, \c File has sticky bit set
|
|
- \c -n, \c String length is non-zero
|
|
- \c -o, \c Logical or
|
|
- \c -p, \c File is named pipe
|
|
- \c -r, \c File is readable
|
|
- \c -s, \c File size is non-zero
|
|
- \c -t, \c FD is terminal
|
|
- \c -u, \c File set-user-ID bit is set
|
|
- \c -w, \c File is writable
|
|
- \c -x, \c File is executable
|
|
- \c -z, \c String length is zero
|
|
|
|
\subsection test-example Example
|
|
|
|
<pre>
|
|
if test -d "/"
|
|
echo "Fish is cool"
|
|
end
|
|
</pre>
|
|
|
|
Because "/" is a directory the expression will evaluate
|
|
to true, and "Fish is cool" will be echoed
|