line Command

Purpose

Reads one line from the standard input.

Syntax

line

Description

The line command copies one line from standard input and writes it to standard output. It returns an exit value of 1 on an end-of-file and always writes at least a new-line character. Use this command within a shell command file to read from the work station.

Exit Status

This command returns the following exit values:

Item Description
0 Successful completion.
>0 End-of-file occurred on input.

Examples

To read a line from the keyboard and append it to a file, create a script file as follows:

echo 'Enter comments for the log:'
echo ': \c'
line >>log

This shell procedure displays the message:

Enter comments for the log:

and then reads a line of text from the workstation keyboard and adds it to the end of the log. The echo ': \c' command displays a colon prompt. See the echo command for information about the \c escape sequence.