- read - read a line from standard input
- read [ options ] [var?prompt] [var ...]
- read reads a line from standard input and breaks it into fields using the characters in value of the IFS variable as separators.
The escape character, \, is used to remove any special meaning for the next character and for line continuation unless the -r option
- If there are more variables than fields, the remaining variables are set to empty strings. If there are fewer variables than fields, the
leftover fields and their intervening separators are assigned to the last variable. If no var is specified then the variable REPLY is
- When var has the binary attribute and -n or -N is specified, the bytes that are read are stored directly into var.
- If you specify ?prompt after the first var, then read will display prompt on standard error when standard
input is a terminal or pipe.
- Unset var and then create an indexed array containing each field in the line starting at index 0.
- Unset var and read var as a compound variable.
- -d delim
- Read until delimiter delim instead of to the end of line.
- Read from the current co-process instead of standard input. An end of file causes read to disconnect the co-process so that
another can be created.
- Do not treat \ specially when processing the input line.
- Save a copy of the input as an entry in the shell history file.
- -u fd
- Read from file descriptor number fd instead of standard input. The default value is 0.
- -t timeout
- Specify a timeout timeout in seconds when reading from a terminal or pipe.
- -n nchar
- Read at most nchar characters. For binary fields size will be in bytes.
- -N nchar
- Read exactly nchar characters. For binary fields size will be in bytes.
- When reading from a terminal the value of the first variable is displayed and used as a default value.
- Successful completion.
- End of file was detected or an error occurred.
- print(1), printf(1), cat(1)
- read (AT&T Research) 2006-12-19
- David Korn <firstname.lastname@example.org>
- Copyright © 1982-2010 AT&T Intellectual Property