read(1) read(1)
NAME
read - read standard input
SYNOPSIS
read [-r] var1 ...
DESCRIPTION
Each call to read obtains the next line (up to a newline) from
the standard input and parses it into fields, assigning each
field value to the shell variables that are listed as
parameters.
Let
m be the number of input fields on an input line.
n be the number of shell variables on the read command
line.
then
If m == n
The ith field is assigned to the ith variable.
If m > n
The ith field is assigned to the ith variable; however,
the excess fields are concatenated onto the nth
variable.
If m < n
The ith field is assigned to the ith variable and the
excess variables are assigned NULL strings.
Fields are defined to be sequences of characters separated by
characters from the IFS (inter-field separators) environment
variable (default values are blank, tab, and newline). A
backslash at the end of a line will cause input to continue
onto the next line.
-r Suppress special treatment of the backslash character.
Each backslash character will become part of the input
line.
Exit Codes
The exit code is 0 whenever data is returned. When no data
can be obtained, the exit status is 1.
Copyright 1994 Novell, Inc. Page 1
read(1) read(1)
USAGE
It is often used within shell programs to read from the user's
terminal
The LC_CTYPE environment variable defines the processing of
the codesets used in the input file. [See LANG in
environ(5).]
REFERENCES
ksh(1), sh(1)
Copyright 1994 Novell, Inc. Page 2