Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ line(1) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

read(1)

sh(1)

read(2)

line(1)                                                             line(1)

NAME
     line - read one line

SYNOPSIS
     line

DESCRIPTION
     line copies one line from the standard input (including the newline
     character) and writes it on the standard output. The minimum output is
     one newline character. The line command is typically used in shell
     scripts when user input is to be processed interactively.

     You can also use the built-in command read instead of line.

EXIT STATUS
     0    normal exit

     >0   end-of-file character (EOF) encountered in input

EXAMPLES
     The shell script customers is to be used to check whether a particular
     customer is entered in the file named list.

     Contents of customers:

     echo "Enter a customer name and hit return."
     NAME=`line`
     if grep $NAME list
     then echo "Customer $NAME is already in list"
     else echo "Customer $NAME is not in list"
     fi

     When the script customers is run (execute permission is required), the
     user is prompted to enter a customer name. The input is then read in
     by line and assigned as the value of the variable NAME. The if state-
     ment checks the exit status of the grep command. If this value is 0,
     i.e. grep was successful in locating the value of the NAME variable
     ($NAME) in the file list, the message Customer $NAME is already in
     list is displayed.

     A non-zero exit status means that grep has not found the name, in
     which case the message Customer $NAME is not in list is issued.

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










Page 1                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026