mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-27 03:13:37 +08:00
docs: standardise on exit status terminology
Exit status is used in the POSIX specification and is preferred over return code/return status/exit code. [ci skip]
This commit is contained in:
parent
2f6c8fb21a
commit
4265b02eb3
|
@ -95,7 +95,7 @@ Each option specification is a string composed of
|
|||
|
||||
- ``=+`` if it requires a value and each instance of the flag is saved.
|
||||
|
||||
- Optionally a ``!`` followed by fish script to validate the value. Typically this will be a function to run. If the return status is zero the value for the flag is valid. If non-zero the value is invalid. Any error messages should be written to stdout (not stderr). See the section on `Flag Value Validation <#flag-value-validation>`__ for more information.
|
||||
- Optionally a ``!`` followed by fish script to validate the value. Typically this will be a function to run. If the exit status is zero the value for the flag is valid. If non-zero the value is invalid. Any error messages should be written to stdout (not stderr). See the section on `Flag Value Validation <#flag-value-validation>`__ for more information.
|
||||
|
||||
See the :ref:`fish_opt <cmd-fish_opt>` command for a friendlier but more verbose way to create option specifications.
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ The following options are available:
|
|||
|
||||
- ``-a`` or ``--all`` returns all the external COMMANDNAMEs that are found in ``$PATH`` in the order they are found.
|
||||
|
||||
- ``-q`` or ``--quiet``, silences the output and prints nothing, setting only the exit code. Implies ``--search``.
|
||||
- ``-q`` or ``--quiet``, silences the output and prints nothing, setting only the exit status. Implies ``--search``.
|
||||
|
||||
- ``-s`` or ``--search`` returns the name of the external command that would be executed, or nothing if no file with the specified name could be found in the ``$PATH``.
|
||||
|
||||
|
|
|
@ -12,6 +12,6 @@ exit [STATUS]
|
|||
Description
|
||||
-----------
|
||||
|
||||
``exit`` causes fish to exit. If ``STATUS`` is supplied, it will be converted to an integer and used as the exit code. Otherwise, the exit code will be that of the last command executed.
|
||||
``exit`` causes fish to exit. If ``STATUS`` is supplied, it will be converted to an integer and used as the exit status. Otherwise, the exit status will be that of the last command executed.
|
||||
|
||||
If exit is called while sourcing a file (using the :ref:`source <cmd-source>` builtin) the rest of the file will be skipped, but the shell itself will not exit.
|
||||
|
|
|
@ -24,11 +24,11 @@ jobs accepts the following switches:
|
|||
|
||||
- ``-p`` or ``--pid`` prints the process ID for each process in all jobs.
|
||||
|
||||
- ``-q`` or ``--quiet`` prints no output for evaluation of jobs by exit code only.
|
||||
- ``-q`` or ``--quiet`` prints no output for evaluation of jobs by exit status only.
|
||||
|
||||
On systems that supports this feature, jobs will print the CPU usage of each job since the last command was executed. The CPU usage is expressed as a percentage of full CPU activity. Note that on multiprocessor systems, the total activity may be more than 100\%.
|
||||
|
||||
The exit code of the ``jobs`` builtin is ``0`` if there are running background jobs and ``1`` otherwise.
|
||||
The exit status of the ``jobs`` builtin is ``0`` if there are running background jobs and ``1`` otherwise.
|
||||
|
||||
no output.
|
||||
----------
|
||||
|
|
|
@ -39,7 +39,7 @@ Notes
|
|||
1. Using the *normal* keyword will reset both background and foreground colors to whatever is the default for the terminal.
|
||||
2. Setting the background color only affects subsequently written characters. Fish provides no way to set the background color for the entire terminal window. Configuring the window background color (and other attributes such as its opacity) has to be done using whatever mechanisms the terminal provides.
|
||||
3. Some terminals use the ``--bold`` escape sequence to switch to a brighter color set rather than increasing the weight of text.
|
||||
4. ``set_color`` works by printing sequences of characters to *stdout*. If used in command substitution or a pipe, these characters will also be captured. This may or may not be desirable. Checking the exit code of ``isatty stdout`` before using ``set_color`` can be useful to decide not to colorize output in a script.
|
||||
4. ``set_color`` works by printing sequences of characters to *stdout*. If used in command substitution or a pipe, these characters will also be captured. This may or may not be desirable. Checking the exit status of ``isatty stdout`` before using ``set_color`` can be useful to decide not to colorize output in a script.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
|
|
@ -17,7 +17,7 @@ Description
|
|||
|
||||
If no file is specified and stdin is not the terminal, or if the file name '``-``' is used, stdin will be read.
|
||||
|
||||
The return status of ``source`` is the return status of the last job to execute. If something goes wrong while opening or reading the file, ``source`` exits with a non-zero status.
|
||||
The exit status of ``source`` is the exit status of the last job to execute. If something goes wrong while opening or reading the file, ``source`` exits with a non-zero status.
|
||||
|
||||
``.`` (a single period) is an alias for the ``source`` command. The use of ``.`` is deprecated in favour of ``source``, and ``.`` will be removed in a future version of fish.
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ If ``ARG`` is not present and ``-p`` has been supplied, then the trap commands a
|
|||
|
||||
Signal names are case insensitive and the ``SIG`` prefix is optional.
|
||||
|
||||
The return status is 1 if any ``REASON`` is invalid; otherwise trap returns 0.
|
||||
The exit status is 1 if any ``REASON`` is invalid; otherwise trap returns 0.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
|
|
@ -40,7 +40,7 @@ Note that not all these limits are available in all operating systems.
|
|||
|
||||
The value of limit can be a number in the unit specified for the resource or one of the special values ``hard``, ``soft``, or ``unlimited``, which stand for the current hard limit, the current soft limit, and no limit, respectively.
|
||||
|
||||
If limit is given, it is the new value of the specified resource. If no option is given, then ``-f`` is assumed. Values are in kilobytes, except for ``-t``, which is in seconds and ``-n`` and ``-u``, which are unscaled values. The return status is 0 unless an invalid option or argument is supplied, or an error occurs while setting a new limit.
|
||||
If limit is given, it is the new value of the specified resource. If no option is given, then ``-f`` is assumed. Values are in kilobytes, except for ``-t``, which is in seconds and ``-n`` and ``-u``, which are unscaled values. The exit status is 0 unless an invalid option or argument is supplied, or an error occurs while setting a new limit.
|
||||
|
||||
``ulimit`` also accepts the following switches that determine what type of limit to set:
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ Arguments → Program → Return Values
|
|||
|
||||
- the side effects take the center of the stage: they transform an **input stream of data** into an **output stream of data**. Both of these streams are usually the terminal, but they can be redirected.
|
||||
- the arguments become options or switches paired with data: the switches influence the behaviour of the command
|
||||
- the return value shrinks to an **exit code**: this exit code is 0 when the command executes normally and between 1 and 255 otherwise.
|
||||
- the return value shrinks to an **exit status**: this exit status is generally 0 when the command executes normally and between 1 and 255 otherwise.
|
||||
|
||||
This leads to another way of programming and especially of combining commands:
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user