home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


read

read variable1 [variable2 ... ]

Read one line of standard input and assign each word to the corresponding variable , with all leftover words assigned to the last variable. If only one variable is specified, the entire line will be assigned to that variable. See the Examples here 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: r UNIX in a Nutshell: System V Edition Next: Reference: read
Reference: r Book Index Reference: 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