\section read read - read line of input into variables
\subsection read-synopsis Synopsis
read [OPTIONS] [VARIABLES...]
\subsection read-description Description
The read builtin causes fish to read one line from standard
input and store the result in one or more environment variables.
- -e or --export specifies that the variables will be exported to subshells.
- -g or --global specifies that the variables will be made global.
- -pPROMPT_CMD or --prompt=PROMPT_CMD 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 set_color green; echo read; set_color normal; echo "> ".
- -cCMD or --command=CMD specifies that the initial string in the interactive mode command buffer should be CMD.
Read starts by reading a single line of input from stdin, the line is
then tokenized using the IFS environment variable. Each variable
specified in VARIABLES 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
echo hello|read foo
Will cause the variable \$foo to be assigned the value hello.