Bash read

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Overview

read [-p prompt] name name2 ...

Read a line from the stdin or from the file descriptor specified with -u, and assign the first word to the variable associated with the first name, the second to the variable associated with the second name, and so on, with the leftover words and their intervening separators assigned to the variable associated with the last name. If there are fewer words than variable names, the variables associated with the remaining names are assigned empty values.

The words are split using the IFS characters. The backslash character (\) may be used to remove any special meaning for the next character read and for line continuation.

Timeout