next up previous contents
Next: Control Up: Input/Output Previous: To output to a   Contents

To input from the terminal

Use the read command:-

> echo -n "Do you wish to proceed?"
> read ans

(at this point the script pauses until you
have typed in something e.g. ``yes'')


> echo "You answered $ans"
You answered yes

The -n on the echo command stops it from terminating the line so that your response can be typed in directly to the question.



P.D. Gronbech (IT Staff) 2015-10-02