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


read

read [options ] [variable1 [? string ]] [variable2 ...]

Korn shell only. Same as in the Bourne shell, except that the Korn shell version supports the following options as well as the ? syntax for prompting. If the first variable is followed by ? string , string is displayed as a user prompt. If no variables are given, input is stored in the REPLY variable. Additionally, ksh93 allows you to specify a timeout.

Options

-A array

Read into indexed array array . ksh93 only.

-d delim

Read up to first occurrence of delim , instead of newline. ksh93 only.

-p

Read from the output of a |& coprocess.

-r

Raw mode; ignore \ as a line continuation character.

-s

Save input as a command in the history file.

-t timeout

When reading from a terminal or pipe, if no data is entered after timeout seconds, return l . This prevents an application from hanging forever, waiting for user input. ksh93 only.

-u [n ]

Read input from file descriptor n (default is 0).

Example

Prompt yourself to enter two temperatures:

$ read n1?"High low: " n2


High low: 65 33


Previous: Reference: read UNIX in a Nutshell: System V Edition Next: Reference: readonly
Reference: read Book Index Reference: readonly

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