mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-30 14:24:35 +08:00
76e1cda495
Fish now doesn't join the fish_prompt output. This breaks the default fish_prompt. Make default fish_prompt single-line. Fixes #203. Add -l flag to 'read' documentation. Remove ambiguous '-x' description. Fixes #157.
32 lines
2.1 KiB
Plaintext
32 lines
2.1 KiB
Plaintext
\section read read - read line of input into variables
|
|
|
|
\subsection read-synopsis Synopsis
|
|
<tt>read [OPTIONS] [VARIABLES...]</tt>
|
|
|
|
\subsection read-description Description
|
|
|
|
The <tt>read</tt> builtin causes fish to read one line from standard
|
|
input and store the result in one or more environment variables.
|
|
|
|
- <tt>-c CMD</tt> or <tt>--command=CMD</tt> specifies that the initial string in the interactive mode command buffer should be CMD.
|
|
- <tt>-g</tt> or <tt>--global</tt> specifies that the variables will be made global.
|
|
- <tt>-l</tt> or <tt>--local</tt> specifies that the variables will be made local.
|
|
- <tt>-m NAME</tt> or <tt>--mode-name=NAME</tt> specifies that the name NAME should be used to save/load the history file. If NAME is fish, the regular fish history will be available.
|
|
- <tt>-p PROMPT_CMD</tt> or <tt>--prompt=PROMPT_CMD</tt> specifies that the output of the shell command PROMPT_CMD should be used as the prompt for the interactive mode prompt. The default prompt command is <tt>set_color green; echo read; set_color normal; echo "> "</tt>.
|
|
- <code>-s</code> or <code>--shell</code> Use syntax highlighting, tab completions and command termination suitable for entering shellscript code
|
|
- <code>-u</code> or <code>--unexport</code> causes the specified environment not to be exported to child processes
|
|
- <code>-U</code> or <code>--universal</code> causes the specified environment variable to be made universal. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
|
|
- <code>-x</code> or <code>--export</code> causes the specified environment variable to be exported to child processes
|
|
|
|
Read starts by reading a single line of input from stdin, the line is
|
|
then tokenized using the <tt>IFS</tt> environment variable. Each variable
|
|
specified in <tt>VARIABLES</tt> is then assigned one tokenized string
|
|
element. If there are more tokens than variables, the complete
|
|
remainder is assigned to the last variable.
|
|
|
|
\subsection read-example Example
|
|
|
|
<tt>echo hello|read foo</tt>
|
|
|
|
Will cause the variable \$foo to be assigned the value hello.
|