UNIX in a Nutshell: System V Edition

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

read

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

Korn shell only. Same as in the Bourne shell, except that the Korn shell version supports the options below as well as the ? syntax for prompting. If a variable is followed by ?string, then string is displayed as a user prompt. If no variables are given, input is stored in the REPLY variable.

Options

-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.

-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: readUNIX in a Nutshell: System V EditionNext: Reference: readonly
Reference: readBook IndexReference: 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