Полезная информация

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: rChapter 4
The Bourne Shell and Korn Shell
Next: Reference: read
 

read

read variable1 [variable2 ...]

Read one line of standard input, and assign each word to the corresponding variable, with all leftover words assigned to last variable. If only one variable is specified, the entire line will be assigned to that variable. See example below and under case. The return status is 0 unless EOF is reached.

Example

$ read first last address
Sarah Caldwell 123 Main Street
$ echo "$last, $first\n$address"
Caldwell, Sarah
123 Main Street


Previous: Reference: rUNIX in a Nutshell: System V EditionNext: Reference: read
Reference: rBook IndexReference: read

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System