Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

User Commands (k - l) line(1)
NAME
line - Reads one line from the standard input le and copies it to standard output le
SYNOPSIS
line
DESCRIPTION
The line command copies one line up to and including a newline character from the standard
input le and writes it to the standard output le. The line command always writes at least a
newline character.
Use this command within a shell command le to read from your terminal.
EXAMPLES
To read a line entered from the keyboard and append it to a le, enter:
echo Enter comments for the log:
echo :\c
line >>log
This shell procedure displays the message:
Enter comments for the log:
It then reads a line of text entered from the keyboard and adds it to the end of the le log. The
echo :\ccommand displays a : (colon) prompt. See the echo command for information about
the \c escape sequence.
NOTES
Applications should use the read command instead of the line command.
EXIT VALUES
The line command returns a value of 1 when it detects an end-of-le; otherwise, the line com-
mand returns a value of 0 (zero).
RELATED INFORMATION
Commands: echo(1), ksh(1), sh(1).
Functions: read(2).
STANDARDS CONFORMANCE
This command conforms to the XPG4 Version 2 specication.
527188-004 Hewlett-Packard Company 559