line(1)

line(1)

NAME

line - read one line from user input

SYNOPSIS

line [-t timeout ]

DESCRIPTION

line copies one line (up to a new-line) from the standard input and writes it on the standard output. It returns an exit code of 1 on EOF and always prints at least a new-line. It is often used within shell ®les to read from the user's terminal.

Options

line recognizes the following command-line option:

-ttimeout Timeout after timeout seconds where timeout is an integer value (if a non-integer value is speci®ed, it is converted to an integer; i.e., rounded down). A blank is required between -tand the timeout argument. This option is not documented in POSIX and other industry standards, and should not be used in portable applications.

EXTERNAL INFLUENCES

International Code Set Support

Single- and multi-byte character code sets are supported.

EXAMPLES

The following lines in a shell script prompt for a ®le name and display information about the ®le:

echo 'Enter file name: \c' reply=`line`

ls -l $reply

To limit the response time to 10 seconds, use the form:

reply=`line -t 10`

then test for no response. If no response occurs before timeout expires, a default behavior should be pro- vided.

WARNINGS

This command is likely to be withdrawn from X/Open standards. Applications using this command might not be portable to other vendors' systems. As an alternative read is recommended.

SEE ALSO sh(1), read(2).

STANDARDS CONFORMANCE line: SVID2, SVID3, XPG2, XPG3

l

HP-UX Release 11i: December 2000

− 1 −

Section 1451