mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 05:53:59 +00:00
More synopsis work.
A great leap forward
This commit is contained in:
parent
6c6a8f93e9
commit
14d60ccb32
45 changed files with 131 additions and 201 deletions
|
@ -6,9 +6,7 @@ nextd - move forward through directory history
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
nextd [ -l | --list ] [POS]
|
||||
``nextd`` [ **-l** | **--list** ] [*POS*]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ not - negate the exit status of a job
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
not COMMAND [OPTIONS...]
|
||||
**not** *COMMAND* [*options*...]
|
||||
|
||||
|
||||
Description
|
||||
|
|
|
@ -6,9 +6,7 @@ open - open file in its default application
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
open FILES...
|
||||
``open`` *FILES*...
|
||||
|
||||
|
||||
Description
|
||||
|
|
|
@ -6,9 +6,7 @@ or - conditionally execute a command
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
COMMAND1; or COMMAND2
|
||||
*COMMAND1*; **or** *COMMAND2*
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ popd - move through directory stack
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
popd
|
||||
``popd``
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ prevd - move backward through directory history
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
prevd [ -l | --list ] [POS]
|
||||
``prevd`` [ **-l** | **--list** ] [*POS*]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ printf - display text according to a format string
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
printf FORMAT [ARGUMENT ...]
|
||||
``printf`` *FORMAT* [*ARGUMENT* ...]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,11 +6,7 @@ prompt_hostname - print the hostname, shortened for use in the prompt
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
function fish_prompt
|
||||
echo -n (whoami)@(prompt_hostname) (prompt_pwd) '$ '
|
||||
end
|
||||
``prompt_hostname``
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
@ -20,6 +16,12 @@ Description
|
|||
Examples
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
function fish_prompt
|
||||
echo -n (whoami)@(prompt_hostname) (prompt_pwd) '$ '
|
||||
end
|
||||
|
||||
::
|
||||
|
||||
# The machine's full hostname is foo.bar.com
|
||||
|
|
|
@ -6,11 +6,7 @@ prompt_login - describe the login suitable for prompt
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
function fish_prompt
|
||||
echo -n (prompt_login) (prompt_pwd) '$ '
|
||||
end
|
||||
``prompt_login``
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
@ -19,6 +15,11 @@ Description
|
|||
|
||||
Examples
|
||||
--------
|
||||
::
|
||||
|
||||
function fish_prompt
|
||||
echo -n (prompt_login) (prompt_pwd) '$ '
|
||||
end
|
||||
|
||||
::
|
||||
|
||||
|
|
|
@ -6,11 +6,7 @@ prompt_pwd - print pwd suitable for prompt
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
function fish_prompt
|
||||
echo -n (prompt_pwd) '$ '
|
||||
end
|
||||
``prompt_pwd``
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ psub - perform process substitution
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
COMMAND1 ( COMMAND2 | psub [-F | --fifo] [-f | --file] [-s SUFFIX])
|
||||
*COMMAND1* ( *COMMAND2* | ``psub`` [**-F** | -**-fifo**] [**-f** | **--file**] [**-s** *SUFFIX*] )
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ pushd - push directory to directory stack
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
pushd [DIRECTORY]
|
||||
``pushd`` *DIRECTORY*
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,8 @@ pwd - output the current working directory
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
pwd [(-P | --physical)] [(-L | --logical)]
|
||||
| ``pwd`` [**-P** | **--physical**]
|
||||
| ``pwd`` [**-L** | **--logical**]
|
||||
|
||||
|
||||
Description
|
||||
|
|
|
@ -6,13 +6,11 @@ random - generate random number
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
random
|
||||
random SEED
|
||||
random START END
|
||||
random START STEP END
|
||||
random choice [ITEMS...]
|
||||
| ``random``
|
||||
| ``random`` *SEED*
|
||||
| ``random`` *START* *END*
|
||||
| ``random`` *START* *STEP* *END*
|
||||
| ``random`` choice [*ITEMS*...]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ read - read line of input into variables
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
read [OPTIONS] [VARIABLE ...]
|
||||
``read`` [*options*] [*VARIABLE* ...]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,22 +6,20 @@ set - display and change shell variables
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
set [SCOPE_OPTIONS]
|
||||
set [OPTIONS] VARIABLE_NAME VALUES...
|
||||
set [OPTIONS] VARIABLE_NAME[INDICES]... VALUES...
|
||||
set ( -q | --query ) [SCOPE_OPTIONS] VARIABLE_NAMES...
|
||||
set ( -e | --erase ) [SCOPE_OPTIONS] VARIABLE_NAME...
|
||||
set ( -e | --erase ) [SCOPE_OPTIONS] VARIABLE_NAME[INDICES]...
|
||||
set ( -S | --show ) [VARIABLE_NAME]...
|
||||
| ``set`` [*scope options*]
|
||||
| ``set`` [*options*] *VARIABLE* *VALUES*...
|
||||
| ``set`` [*options*] *VARIABLE*[*indicies*]... *VALUES*...
|
||||
| ``set`` ( **-q** | **--query** ) [*scope options*] *VARIABLE* ...
|
||||
| ``set`` ( **-e** | **--erase** ) [*scope options*] *VARIABLE* ...
|
||||
| ``set`` ( **-e** | **--erase** ) [*scope options*] *VARIABLE*\[*indicies*] ...
|
||||
| ``set`` ( **-S** | **--show** ) *VARIABLE*...
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``set`` manipulates :ref:`shell variables <variables>`.
|
||||
|
||||
If both a variable name and values are provided, ``set`` assigns the values to the variable of that name. Because all variables in fish are :ref:`lists <variables-lists>`, multiple values are allowed.
|
||||
If both a *VARIABLE* and *VALUES* are provided, ``set`` assigns the values to the variable of that name. Because all variables in fish are :ref:`lists <variables-lists>`, multiple values are allowed.
|
||||
|
||||
If only a variable name has been given, ``set`` sets the variable to the empty list.
|
||||
|
||||
|
@ -109,7 +107,6 @@ In erase mode, ``set`` exits with a zero exit status in case of success, with a
|
|||
Examples
|
||||
--------
|
||||
|
||||
|
||||
::
|
||||
|
||||
# Prints all global, exported variables.
|
||||
|
|
|
@ -6,9 +6,7 @@ set_color - set the terminal color
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
set_color [OPTIONS] VALUE
|
||||
``set_color`` [*options*] *VALUE*
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,16 +6,14 @@ source - evaluate contents of file
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
source FILENAME [ARGUMENTS...]
|
||||
somecommand | source
|
||||
| **source** *FILE* [*arguments*...]
|
||||
| ``somecommand`` | **source**
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``source`` evaluates the commands of the specified file in the current shell as a new block of code. This is different from starting a new process to perform the commands (i.e. ``fish < FILENAME``) since the commands will be evaluated by the current shell, which means that changes in shell variables will affect the current shell. If additional arguments are specified after the file name, they will be inserted into the ``$argv`` variable. The ``$argv`` variable will not include the name of the sourced file.
|
||||
``source`` evaluates the commands of the specified file in the current shell as a new block of code. This is different from starting a new process to perform the commands (i.e. ``fish < FILE``) since the commands will be evaluated by the current shell, which means that changes in shell variables will affect the current shell. If additional arguments are specified after the file name, they will be inserted into the ``$argv`` variable. The ``$argv`` variable will not include the name of the sourced file.
|
||||
|
||||
fish will search the working directory to resolve relative paths but will not search ``$PATH``.
|
||||
|
||||
|
|
|
@ -6,28 +6,26 @@ status - query fish runtime information
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
status
|
||||
status is-login
|
||||
status is-interactive
|
||||
status is-block
|
||||
status is-breakpoint
|
||||
status is-command-substitution
|
||||
status is-no-job-control
|
||||
status is-full-job-control
|
||||
status is-interactive-job-control
|
||||
status current-command
|
||||
status filename
|
||||
status basename
|
||||
status dirname
|
||||
status fish-path
|
||||
status function
|
||||
status line-number
|
||||
status stack-trace
|
||||
status job-control CONTROL_TYPE
|
||||
status features
|
||||
status test-feature FEATURE
|
||||
**status**
|
||||
**status** is-login
|
||||
**status** is-interactive
|
||||
**status** is-block
|
||||
**status** is-breakpoint
|
||||
**status** is-command-substitution
|
||||
**status** is-no-job-control
|
||||
**status** is-full-job-control
|
||||
**status** is-interactive-job-control
|
||||
**status** current-command
|
||||
**status** filename
|
||||
**status** basename
|
||||
**status** dirname
|
||||
**status** fish-path
|
||||
**status** function
|
||||
**status** line-number
|
||||
**status** stack-trace
|
||||
**status** job-control *CONTROL_TYPE*
|
||||
**status** features
|
||||
**status** test-feature *FEATURE*
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string collect [(-a | --allow-empty)] [(-N | --no-trim-newlines)] [STRING...]
|
||||
``string`` collect [**-N** | **--no-trim-newlines**] [*STRING*...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -6,10 +6,8 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string escape [(-n | --no-quoted)] [--style=xxx] [STRING...]
|
||||
string unescape [--style=xxx] [STRING...]
|
||||
| ``string`` escape [**-n** | **--no-quoted**] [**--style=**] [*STRING*...]
|
||||
| ``string`` unescape [**--style=**] [*STRING*...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -6,10 +6,8 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string join [(-q | --quiet)] SEP [STRING...]
|
||||
string join0 [(-q | --quiet)] [STRING...]
|
||||
| ``string`` join [**-q** | **--quiet**] SEP [*STRING*...]
|
||||
| ``string`` join0 [**-q** | **--quiet**] [*STRING*...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -8,9 +8,7 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string length [(-q | --quiet)] [(-V | --visible)] [STRING...]
|
||||
``string`` length [**-q** | **--quiet**] [*STRING*...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -6,9 +6,7 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string lower [(-q | --quiet)] [STRING...]
|
||||
``string`` lower [**-q** | **--quiet**] [*STRING*...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string match [(-a | --all)] [(-e | --entire)] [(-i | --ignore-case)] [(-g | --groups-only)] [(-r | --regex)] [(-n | --index)] [(-q | --quiet)] [(-v | --invert)] PATTERN [STRING...]
|
||||
``string`` match [**-a** | **--all**] [**-e** | **--entire**] [**-i** | **--ignore-case**]
|
||||
\ \ [**-r** | **--regex**] [**-n** | **--index**] [**-q** | **--quiet**] [**-v** | **--invert**]
|
||||
\ \ *PATTERN* [*STRING*...]
|
||||
|
||||
. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string pad [(-r | --right)] [(-c | --char) CHAR] [(-w | --width) INTEGER] [STRING...]
|
||||
``string`` pad [**-r** | **--right**] [**-c** | **--char** *CHAR*] [**-w** | **--width** *INTEGER*]
|
||||
\ \ [*STRING*...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string repeat [(-n | --count) COUNT] [(-m | --max) MAX] [(-N | --no-newline)] [(-q | --quiet)] [STRING...]
|
||||
``string`` repeat [**-n** | **--count** *COUNT*] [**-m** | **--max** *MAX*] [**-N** | **--no-newline**]
|
||||
\ \ [**-q** | **--quiet**] [*STRING*...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string replace [(-a | --all)] [(-f | --filter)] [(-i | --ignore-case)] [(-r | --regex)] [(-q | --quiet)] PATTERN REPLACEMENT [STRING...]
|
||||
``string`` replace [**-a** | **--all**] [**-f** | **--filter**] [**-i** | **--ignore-case**]
|
||||
\ \ [**-r** | **--regex**] [**-q** | **--quiet**] *PATTERN* *REPLACE* [*STRING*...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string split [(-f | --fields) FIELDS] [(-m | --max) MAX] [(-n | --no-empty)] [(-q | --quiet)] [(-r | --right)] SEP [STRING...]
|
||||
string split0 [(-f | --fields) FIELDS] [(-m | --max) MAX] [(-n | --no-empty)] [(-q | --quiet)] [(-r | --right)] [STRING...]
|
||||
| ``string`` split [**-m** | **--max** *MAX*] [**-n** | **--no-empty**] [**-q** | **--quiet**]
|
||||
\ \ [**-r** | **--right**] *SEP* [*STRING*...]
|
||||
| ``string`` split0 [**-m** | **--max** *MAX*] [**-n** | **--no-empty**] [**-q** | **--quiet**]
|
||||
\ \ [**-r** | **--right**] [*STRING*...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string sub [(-s | --start) START] [(-e | --end) END] [(-l | --length) LENGTH] [(-q | --quiet)] [STRING...]
|
||||
``string`` sub [**-s** | **--start** *START*] [**-l** | **--length** *LENGTH*]
|
||||
\ [**-q** | **--quiet**] [*STRING*...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string trim [(-l | --left)] [(-r | --right)] [(-c | --chars CHARS)] [(-q | --quiet)] [STRING...]
|
||||
``string`` trim [**-l** | **--left**] [**-r** | **--right**] [**-c** | **--chars** CHARS*]
|
||||
\ \ [**-q** | **--quiet**] [*STRING*...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -6,9 +6,7 @@ Synopsis
|
|||
|
||||
.. BEGIN SYNOPSIS
|
||||
|
||||
::
|
||||
|
||||
string upper [(-q | --quiet)] [STRING...]
|
||||
``string`` upper [**-q** | **--quiet**] [*STRING*...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
|
|
@ -6,24 +6,31 @@ string - manipulate strings
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
string collect [(-N | --no-trim-newlines)] [STRING...]
|
||||
string escape [(-n | --no-quoted)] [--style=xxx] [STRING...]
|
||||
string join [(-q | --quiet)] SEP [STRING...]
|
||||
string join0 [(-q | --quiet)] [STRING...]
|
||||
string length [(-q | --quiet)] [STRING...]
|
||||
string lower [(-q | --quiet)] [STRING...]
|
||||
string match [(-a | --all)] [(-e | --entire)] [(-i | --ignore-case)] [(-r | --regex)] [(-n | --index)] [(-q | --quiet)] [(-v | --invert)] PATTERN [STRING...]
|
||||
string pad [(-r | --right)] [(-c | --char) CHAR] [(-w | --width) INTEGER] [STRING...]
|
||||
string repeat [(-n | --count) COUNT] [(-m | --max) MAX] [(-N | --no-newline)] [(-q | --quiet)] [STRING...]
|
||||
string replace [(-a | --all)] [(-f | --filter)] [(-i | --ignore-case)] [(-r | --regex)] [(-q | --quiet)] PATTERN REPLACEMENT [STRING...]
|
||||
string split [(-m | --max) MAX] [(-n | --no-empty)] [(-q | --quiet)] [(-r | --right)] SEP [STRING...]
|
||||
string split0 [(-m | --max) MAX] [(-n | --no-empty)] [(-q | --quiet)] [(-r | --right)] [STRING...]
|
||||
string sub [(-s | --start) START] [(-l | --length) LENGTH] [(-q | --quiet)] [STRING...]
|
||||
string trim [(-l | --left)] [(-r | --right)] [(-c | --chars CHARS)] [(-q | --quiet)] [STRING...]
|
||||
string unescape [--style=xxx] [STRING...]
|
||||
string upper [(-q | --quiet)] [STRING...]
|
||||
| ``string`` collect [**-N** | **--no-trim-newlines**] [*STRING*...]
|
||||
| ``string`` escape [**-n** | **--no-quoted**] [**--style=**] [*STRING*...]
|
||||
| ``string`` join [**-q** | **--quiet**] SEP [*STRING*...]
|
||||
| ``string`` join0 [**-q** | **--quiet**] [*STRING*...]
|
||||
| ``string`` length [**-q** | **--quiet**] [*STRING*...]
|
||||
| ``string`` lower [**-q** | **--quiet**] [*STRING*...]
|
||||
| ``string`` match [**-a** | **--all**] [**-e** | **--entire**] [**-i** | **--ignore-case**]
|
||||
\ \ [**-r** | **--regex**] [**-n** | **--index**] [**-q** | **--quiet**] [**-v** | **--invert**]
|
||||
\ \ *PATTERN* [*STRING*...]
|
||||
| ``string`` pad [**-r** | **--right**] [**-c** | **--char** *CHAR*] [**-w** | **--width** *INTEGER*]
|
||||
\ \ [*STRING*...]
|
||||
| ``string`` repeat [**-n** | **--count** *COUNT*] [**-m** | **--max** *MAX*] [**-N** | **--no-newline**]
|
||||
\ \ [**-q** | **--quiet**] [*STRING*...]
|
||||
| ``string`` replace [**-a** | **--all**] [**-f** | **--filter**] [**-i** | **--ignore-case**]
|
||||
\ \ [**-r** | **--regex**] [**-q** | **--quiet**] *PATTERN* *REPLACE* [*STRING*...]
|
||||
| ``string`` split [**-m** | **--max** *MAX*] [**-n** | **--no-empty**] [**-q** | **--quiet**]
|
||||
\ \ [**-r** | **--right**] *SEP* [*STRING*...]
|
||||
| ``string`` split0 [**-m** | **--max** *MAX*] [**-n** | **--no-empty**] [**-q** | **--quiet**]
|
||||
\ \ [**-r** | **--right**] [*STRING*...]
|
||||
| ``string`` sub [**-s** | **--start** *START*] [**-l** | **--length** *LENGTH*]
|
||||
\ [**-q** | **--quiet**] [*STRING*...]
|
||||
| ``string`` trim [**-l** | **--left**] [**-r** | **--right**] [**-c** | **--chars** CHARS*]
|
||||
\ \ [**-q** | **--quiet**] [*STRING*...]
|
||||
| ``string`` unescape [**--style=**] [*STRING*...]
|
||||
| ``string`` upper [**-q** | **--quiet**] [*STRING*...]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ suspend - suspend the current shell
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
suspend [--force]
|
||||
``suspend`` [**--force**]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,16 +6,14 @@ switch - conditionally execute a block of commands
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
switch VALUE; [case [WILDCARD...]; [COMMANDS...]; ...] end
|
||||
**switch** *VALUE*; [**case** [*GLOB*...]; [*COMMANDS*...]; ...] **end**
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``switch`` performs one of several blocks of commands, depending on whether a specified value equals one of several wildcarded values. ``case`` is used together with the ``switch`` statement in order to determine which block should be executed.
|
||||
``switch`` performs one of several blocks of commands, depending on whether a specified value equals one of several globbed values. ``case`` is used together with the ``switch`` statement in order to determine which block should be executed.
|
||||
|
||||
Each ``case`` command is given one or more parameters. The first ``case`` command with a parameter that matches the string specified in the switch command will be evaluated. ``case`` parameters may contain wildcards. These need to be escaped or quoted in order to avoid regular wildcard expansion using filenames.
|
||||
Each ``case`` command is given one or more parameters. The first ``case`` command with a parameter that matches the string specified in the switch command will be evaluated. ``case`` parameters may contain globs. These need to be escaped or quoted in order to avoid regular glob expansion using filenames.
|
||||
|
||||
Note that fish does not fall through on case statements. Only the first matching case is executed.
|
||||
|
||||
|
|
|
@ -6,10 +6,8 @@ test - perform tests on files and text
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
test [EXPRESSION]
|
||||
[ [EXPRESSION] ]
|
||||
| ``test`` [*EXPRESSION*]
|
||||
| ``[`` [*EXPRESSION*] ]
|
||||
|
||||
|
||||
Description
|
||||
|
|
|
@ -6,9 +6,7 @@ time - measure how long a command or block takes
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
time COMMAND
|
||||
**time** *COMMAND*
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ trap - perform an action when the shell receives a signal
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
trap [OPTIONS] [[ARG] REASON ... ]
|
||||
``trap`` [*options*] [[*ARG*] *REASON* ... ]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ true - return a successful result
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
true
|
||||
``true``
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,7 +6,7 @@ type - locate a command and describe its type
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
**type** [*OPTIONS*] *NAME* [*NAME* ...]
|
||||
``type`` [*options*] *NAME* [...]
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ ulimit - set or get resource usage limits
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
ulimit [OPTIONS] [LIMIT]
|
||||
```ulimit`` [**options**] [*limit*]
|
||||
|
||||
|
||||
Description
|
||||
|
|
|
@ -6,9 +6,7 @@ umask - set or get the file creation mode mask
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
umask [OPTIONS] [MASK]
|
||||
``umask`` [**options**] [*MASK*]
|
||||
|
||||
|
||||
Description
|
||||
|
|
|
@ -6,9 +6,7 @@ vared - interactively edit the value of an environment variable
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
vared VARIABLE_NAME
|
||||
``vared`` *VARIABLE_NAME*
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
|
|
@ -6,9 +6,7 @@ wait - wait for jobs to complete
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
wait [-n | --any] [PID | PROCESS_NAME] ...
|
||||
``wait`` [**-n** | **--any**] [*PID* | *PROCESS_NAME*] ...
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
@ -18,13 +16,11 @@ Description
|
|||
- If a pid is specified, the command waits for the job that the process with the pid belongs to.
|
||||
- If a process name is specified, the command waits for the jobs that the matched processes belong to.
|
||||
- If neither a pid nor a process name is specified, the command waits for all background jobs.
|
||||
- If the ``-n`` / ``--any`` flag is provided, the command returns as soon as the first job completes. If it is not provided, it returns after all jobs complete.
|
||||
- If the **-n** / **--any** flag is provided, the command returns as soon as the first job completes. If it is not provided, it returns after all jobs complete.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
sleep 10 &
|
||||
|
|
|
@ -6,25 +6,20 @@ while - perform a set of commands multiple times
|
|||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
while CONDITION; COMMANDS...; end
|
||||
|
||||
**while** *CONDITION*; *COMMANDS...*; **end**
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``while`` repeatedly executes ``CONDITION``, and if the exit status is 0, then executes ``COMMANDS``.
|
||||
**while** repeatedly executes ``CONDITION``, and if the exit status is 0, then executes ``COMMANDS``.
|
||||
|
||||
The exit status of the while loop is the exit status of the last iteration of the ``COMMANDS`` executed, or 0 if none were executed. (This matches other shells and is POSIX-compatible.)
|
||||
The exit status of the **while** loop is the exit status of the last iteration of the ``COMMANDS`` executed, or 0 if none were executed. (This matches other shells and is POSIX-compatible.)
|
||||
|
||||
You can use :ref:`and <cmd-and>` or :ref:`or <cmd-or>` for complex conditions. Even more complex control can be achieved with ``while true`` containing a :ref:`break <cmd-break>`.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
while test -f foo.txt; or test -f bar.txt ; echo file exists; sleep 10; end
|
||||
|
|
Loading…
Reference in a new issue