mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 19:41:15 -03:00
Merge branch 'master' into documentation-update
Conflicts (FIXED): doc_src/command.txt doc_src/index.hdr.in doc_src/read.txt doc_src/type.txt
This commit is contained in:
@@ -2,14 +2,23 @@
|
||||
|
||||
\subsection command-synopsis Synopsis
|
||||
\fish{synopsis}
|
||||
command COMMANDNAME [OPTIONS...]
|
||||
command [OPTIONS] COMMANDNAME [ARGS...]
|
||||
\endfish
|
||||
|
||||
\subsection command-description Description
|
||||
|
||||
`command` forces the shell to execute the program `COMMANDNAME` and ignore any functions or builtins with the same name.
|
||||
|
||||
The following options are available:
|
||||
- `-h` or `--help` prints help and then exits.
|
||||
- `-s` or `--search` returns the name of the disk file that would be executed, or nothing if no file with the specified name could be found in the `$PATH`.
|
||||
|
||||
\subsection command-example Example
|
||||
With the `-s` option, `command` treats every argument as a separate command to look up and sets the exit status to 0 if any of the specified commands were found, or 1 if no commands could be found.
|
||||
|
||||
`command ls` causes fish to execute the `ls` program, even if an 'ls' function exists.
|
||||
For basic compatibility with POSIX `command`, the `-v` flag is recognized as an alias for `-s`.
|
||||
|
||||
\subsection command-example Examples
|
||||
|
||||
`command ls` causes fish to execute the `ls` program, even if an `ls` function exists.
|
||||
|
||||
`command -s ls` returns the path to the `ls` program.
|
||||
@@ -416,7 +416,7 @@ Note that if no matches are found for a specific wildcard, it will expand into z
|
||||
|
||||
\subsection expand-command-substitution Command substitution
|
||||
|
||||
The output of a series of commands can be used as the parameters to another command. If a parameter contains a set of parenthesis, the text enclosed by the parenthesis will be interpreted as a list of commands. On expansion, this list is executed, and substituted by the output. If the output is more than one line long, each line will be expanded to a new parameter.
|
||||
The output of a series of commands can be used as the parameters to another command. If a parameter contains a set of parenthesis, the text enclosed by the parenthesis will be interpreted as a list of commands. On expansion, this list is executed, and substituted by the output. If the output is more than one line long, each line will be expanded to a new parameter. Setting `IFS` to the empty string will disable line splitting.
|
||||
|
||||
The exit status of the last run command substitution is available in the <a href='#variables-status'>status</a> variable.
|
||||
|
||||
@@ -432,6 +432,9 @@ for i in *.jpg; convert $i (basename $i .jpg).png; end
|
||||
# PNG format using the 'convert' program.
|
||||
\endfish
|
||||
|
||||
The command `begin; set -l IFS; set data (cat data.txt); end`
|
||||
will set the `data` variable to the contents of 'data.txt' without
|
||||
splitting it into an array.
|
||||
|
||||
\subsection expand-brace Brace expansion
|
||||
|
||||
@@ -718,40 +721,51 @@ certain environment variables.
|
||||
|
||||
- `CDPATH`, an array of directories in which to search for the new directory for the `cd` builtin. By default, the fish configuration defines `CDPATH` to be a universal variable with the values `.` and `~`.
|
||||
|
||||
- A large number of variable starting with the prefixes `fish_color` and `fish_pager_color`. See <a href='#variables-color'>Variables for changing highlighting colors</a> for more information.
|
||||
- A large number of variable starting with the prefixes `fish_color` and `fish_pager_color.` See <a href='#variables-color'>Variables for changing highlighting colors</a> for more information.
|
||||
|
||||
- `fish_greeting`, the greeting message printed on startup.
|
||||
|
||||
- `LANG`, `LC_ALL`, `LC_COLLATE`, `LC_CTYPE`, `LC_MESSAGES`, `LC_MONETARY`, `LC_NUMERIC` and `LC_TIME` set the language option for the shell and subprograms. See the section <a href='#variables-locale'>Locale variables</a> for more information.
|
||||
|
||||
- `fish_user_paths`, an array of directories that are prepended to PATH. This can be a universal variable.
|
||||
- `fish_user_paths`, an array of directories that are prepended to `PATH`. This can be a universal variable.
|
||||
|
||||
- `PATH`, an array of directories in which to search for commands
|
||||
|
||||
- `umask`, the current file creation mask. The preferred way to change the umask variable is through the <a href="commands.html#umask">umask function</a>. An attempt to set umask to an invalid value will always fail.
|
||||
|
||||
`fish` also sends additional information to the user through the values of certain environment variables. The user cannot change the values of most of these variables.
|
||||
`fish` also sends additional information to the user through the
|
||||
values of certain environment variables. The user cannot change the
|
||||
values of most of these variables.
|
||||
|
||||
- `_`, the name of the currently running command.
|
||||
|
||||
- `argv`, an array of arguments to the shell or function. `argv` is only defined when inside a function call, or if fish was invoked with a list of arguments, like 'fish myscript.fish foo bar'. This variable can be changed by the user.
|
||||
- `argv`, an array of arguments to the shell or function. `argv` is only defined when inside a function call, or if fish was invoked with a list of arguments, like `fish myscript.fish foo bar`. This variable can be changed by the user.
|
||||
|
||||
- `history`, an array containing the last commands that were entered.
|
||||
|
||||
- `HOME`, the user's home directory. This variable can only be changed by the root user.
|
||||
- `HOME`, the user's home directory. This variable can be changed by the user.
|
||||
|
||||
- `IFS`, the internal field separator that is used for word splitting with the <a href="commands.html#read">read builtin</a>. Setting this to the empty string will also disable line splitting in <a href="#expand-command-substitution">command substitution</a>. This variable can be changed by the user.
|
||||
|
||||
- `PWD`, the current working directory.
|
||||
|
||||
- `status`, the <a href="#variables-status">exit status</a> of the last foreground job to exit. If the job was terminated through a signal, the exit status will be 128 plus the signal number.
|
||||
|
||||
- `USER`, the current username. This variable can only be changed by the root user.
|
||||
- `USER`, the current username. This variable can be changed by the user.
|
||||
|
||||
- `CMD_DURATION`, the runtime of the last command in milliseconds.
|
||||
|
||||
The names of these variables are mostly derived from the csh family of shells and differ from the ones used by Bourne style shells such as bash.
|
||||
|
||||
Variables whose name are in uppercase are exported to the commands started by fish, while those in lowercase are not exported. This rule is not enforced by fish, but it is good coding practice to use casing to distinguish between exported and unexported variables. `fish` also uses several variables internally. Such variables are prefixed with the string `__FISH` or `__fish`. These should never be used by the user. Changing their value may break fish.
|
||||
The names of these variables are mostly derived from the csh family of
|
||||
shells and differ from the ones used by Bourne style shells such as
|
||||
bash.
|
||||
|
||||
Variables whose name are in uppercase are exported to the commands
|
||||
started by fish, while those in lowercase are not exported. This rule is not
|
||||
enforced by fish, but it is good coding practice to use casing to
|
||||
distinguish between exported and unexported variables. `fish` also
|
||||
uses several variables internally. Such variables are prefixed with
|
||||
the string `__FISH` or `__fish.` These should never be used by the
|
||||
user. Changing their value may break fish.
|
||||
|
||||
\subsection variables-status The status variable
|
||||
|
||||
@@ -1091,9 +1105,9 @@ If you install fish in your home directory, fish will not work correctly for any
|
||||
|
||||
If you have a question not answered by this documentation, there are several avenues for help:
|
||||
|
||||
-# The official mailing list at <a href='fish-users@lists.sf.net'>fish-users@lists.sf.net</a>
|
||||
-# The Internet Relay Chat channel, \#fish on `irc.oftc.net`
|
||||
-# The <a href="http://github.com/fish-shell/fish-shell/">project GitHub page</a>
|
||||
-# The official mailing list at <a href='https://lists.sf.net/lists/listinfo/fish-users'>fish-users@lists.sf.net</a>
|
||||
-# The Internet Relay Chat channel, `#fish` on `irc.oftc.net`
|
||||
-# The <a href="https://github.com/fish-shell/fish-shell/">project GitHub page</a>
|
||||
|
||||
|
||||
If you have an improvement for fish, you can submit it via the mailing list or the GitHub page.
|
||||
|
||||
@@ -29,15 +29,16 @@ The following options are available:
|
||||
|
||||
- `-x` or `--export` exports the variables to child processes.
|
||||
|
||||
`read` reads a single line of input from stdin, breaks it into tokens based on the `IFS` shell variable, and then assigns one token to each variable specified in `VARIABLES`. If there are more tokens than variables, the complete remainder is assigned to the last variable.
|
||||
- `-a` or `--array` stores the result as an array.
|
||||
|
||||
See the documentation for `set` for more details on the scoping rules for variables.
|
||||
`read` reads a single line of input from stdin, breaks it into tokens based on the `IFS` shell variable, and then assigns one token to each variable specified in `VARIABLES`. If there are more tokens than variables, the complete remainder is assigned to the last variable. As a special case, if `IFS` is set to the empty string, each character of the input is considered a separate token.
|
||||
|
||||
If `-a` or `--array` is provided, only one variable name is allowed and the tokens are stored as an array in this variable.
|
||||
|
||||
|
||||
\subsection read-example Example
|
||||
|
||||
The following code stores the value 'hello' in the shell variable
|
||||
`$foo`.
|
||||
The following code stores the value 'hello' in the shell variable `$foo`.
|
||||
|
||||
\fish
|
||||
echo hello|read foo
|
||||
|
||||
@@ -17,13 +17,13 @@ The following options are available:
|
||||
|
||||
- `-f` or `--no-functions` suppresses function and builtin lookup.
|
||||
|
||||
- `-t` or `--type` prints `keyword`, `function`, `builtin`, or `file` if `NAME` is a shell reserved word, function, builtin, or disk file, respectively.
|
||||
- `-t` or `--type` prints `function`, `builtin`, or `file` if `NAME` is a shell function, builtin, or disk file, respectively.
|
||||
|
||||
- `-p` or `--path` returns the name of the disk file that would be executed, or nothing if 'type -t name' would not return 'file'.
|
||||
- `-p` or `--path` returns the name of the disk file that would be executed, or nothing if `type -t name` would not return `file`.
|
||||
|
||||
- `-P` or `--force-path` returns the name of the disk file that would be executed, or nothing no file with the specified name could be found in the `$PATH`.
|
||||
- `-P` or `--force-path` returns the name of the disk file that would be executed, or nothing if no file with the specified name could be found in the <tt>$PATH</tt>.
|
||||
|
||||
`type` sets the exit status to 0 if the specified command was found, and 1 if it could not be found.
|
||||
- `-q` or `--quiet` suppresses all output; this is useful when testing the exit status.
|
||||
|
||||
|
||||
\subsection type-example Example
|
||||
@@ -31,4 +31,4 @@ The following options are available:
|
||||
\fish
|
||||
type fg
|
||||
# Outputs the string 'fg is a shell builtin'.
|
||||
\endfish
|
||||
\endfish
|
||||
|
||||
Reference in New Issue
Block a user