[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 3

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:

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.

Related Information

The echo command, ksh command, sh command.

The read subroutine.

The Input and Output Handling Programmer's Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs describes the files, commands, and subroutines used for low-level, stream, terminal, and asynchronous I/O interfaces.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]