LINE(1) COMMAND REFERENCE LINE(1)
NAME
line - read one line
SYNOPSIS
line [ timeout ]
DESCRIPTION
Line copies one line (up to a newline) from the standard
input and writes it on the standard output. It returns an
exit code of 1 on EOF and always prints at least a new-line.
It is often used within shell files to read from the user's
terminal.
The timeout argument is an integer which specifies the
maximum time in seconds to wait for input. If no input is
given in that amount of time, line exits with a code of 1.
EXAMPLES
The following is a shell script that asks the user for a
file name and prints the contents of the script. When the
user types an end-of-file, the script exits.
#!/bin/sh
while true
do
Name=`line`
if [ $? != 0 ]
then
exit 0
fi
cat "$Name"
done
The following is a shell script that waits for the user to
type something, reminding him that it is waiting every 10
seconds.
#!/bin/sh
while true
do
if line 0
then
exit 0
fi
echo "\007Waiting for response"
done
Printed 10/17/86 1
LINE(1) COMMAND REFERENCE LINE(1)
RETURN VALUE
[NO_ERRS] Command completed without error.
[USAGE] Incorrect command line syntax. Execution
terminated.
[1] End-of-file reached or timeout with no input
data.
[NP_ERR] An error occurred that was not a system
error. Execution terminated.
[P_ERR] A system error occurred. Execution
terminated. See intro(2) for more
information on system errors.
SEE ALSO
sh(1sh), read(2), select(2).
Printed 10/17/86 2
%%index%%
na:72,56;
sy:128,118;
de:246,620;
ex:866,807;
rv:1817,603;
se:2420,153;
%%index%%000000000105