mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-04 04:31:14 -03:00
Convert \\subsection sections into rst format
This commit is contained in:
@@ -8,7 +8,8 @@ test [EXPRESSION]
|
||||
[ [EXPRESSION] ]
|
||||
|
||||
|
||||
\subsection test-description Description
|
||||
Description
|
||||
------------
|
||||
|
||||
Tests the expression given and sets the exit status to 0 if true, and 1 if false. An expression is made up of one or more operators and their arguments.
|
||||
|
||||
@@ -18,7 +19,8 @@ This test is mostly POSIX-compatible.
|
||||
|
||||
When using a variable as an argument for a test operator you should almost always enclose it in double-quotes. There are only two situations it is safe to omit the quote marks. The first is when the argument is a literal string with no whitespace or other characters special to the shell (e.g., semicolon). For example, `test -b /my/file`. The second is using a variable that expands to exactly one element including if that element is the empty string (e.g., `set x ''`). If the variable is not set, set but with no value, or set to more than one value you must enclose it in double-quotes. For example, `test "$x" = "$y"`. Since it is always safe to enclose variables in double-quotes when used as `test` arguments that is the recommended practice.
|
||||
|
||||
\subsection test-files Operators for files and directories
|
||||
Operators for files and directories
|
||||
------------
|
||||
|
||||
- `-b FILE` returns true if `FILE` is a block device.
|
||||
|
||||
@@ -56,7 +58,8 @@ When using a variable as an argument for a test operator you should almost alway
|
||||
|
||||
- `-x FILE` returns true if `FILE` is marked as executable.
|
||||
|
||||
\subsection test-strings Operators for text strings
|
||||
Operators for text strings
|
||||
------------
|
||||
|
||||
- `STRING1 = STRING2` returns true if the strings `STRING1` and `STRING2` are identical.
|
||||
|
||||
@@ -66,7 +69,8 @@ When using a variable as an argument for a test operator you should almost alway
|
||||
|
||||
- `-z STRING` returns true if the length of `STRING` is zero.
|
||||
|
||||
\subsection test-numbers Operators to compare and examine numbers
|
||||
Operators to compare and examine numbers
|
||||
------------
|
||||
|
||||
- `NUM1 -eq NUM2` returns true if `NUM1` and `NUM2` are numerically equal.
|
||||
|
||||
@@ -82,7 +86,8 @@ When using a variable as an argument for a test operator you should almost alway
|
||||
|
||||
Both integers and floating point numbers are supported.
|
||||
|
||||
\subsection test-combinators Operators to combine expressions
|
||||
Operators to combine expressions
|
||||
------------
|
||||
|
||||
- `COND1 -a COND2` returns true if both `COND1` and `COND2` are true.
|
||||
|
||||
@@ -99,7 +104,8 @@ Expressions can be grouped using parentheses.
|
||||
Note that parentheses will usually require escaping with `\(` to avoid being interpreted as a command substitution.
|
||||
|
||||
|
||||
\subsection test-example Examples
|
||||
Examples
|
||||
------------
|
||||
|
||||
If the `/tmp` directory exists, copy the `/etc/motd` file to it:
|
||||
|
||||
@@ -157,7 +163,8 @@ if test $status -ne 0
|
||||
end
|
||||
\endfish
|
||||
|
||||
\subsection test-standards 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:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user