read | |
---|---|
Operating system | Unix, Unix-like, Inferno |
Type | Command |
read
is a command found on Unix and Unix-like operating systems such as Linux. It reads a line of input from standard input or a file passed as an argument to its -u
flag, and assigns it to one or more variables. Each variable is assigned a successive token (word) from the input where tokens are normally split either by spaces or tabs. If there are more variables than tokens then the remaining variables are unchanged. If there are more tokens than variable then the remaining tokens are assigned to the last variable listed in the command.[1] If the -a flag is used all of the tokens are loaded as separate items into the 1st argument as an array. It is built into shells such as Bash.[2]
© MMXXIII Rich X Search. We shall prevail. All rights reserved. Rich X Search