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


UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: r Chapter 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: r UNIX in a Nutshell: System V Edition Next: Reference: read
Reference: r Book Index Reference: read

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