Open System Services Shell and Utilities Reference Manual (G06.29+, H06.08+, J06.03+)

line(1) OSS Shell and Utilities Reference Manual
NAME
line - Reads one line from the standard input file and copies it to standard output file
SYNOPSIS
line
DESCRIPTION
The line command copies one line up to and including a newline character from the standard
input file and writes it to the standard output file. The line command always writes at least a
newline character.
Use this command within a shell command file to read from your terminal.
EXAMPLES
To read a line entered from the keyboard and append it to a file, 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 file 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-file; 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 specification.
560 Hewlett-Packard Company 527188-021