[Next] [Previous] [Up] [Top] [Contents]

9.7 Interactive Input

9.7.1 Sh

Sh uses the built-in command, read, to read in a line, e.g.:

read param

We can illustrate this with the simple script:


echo "Input a phrase \c" # This is /bin/echo which requires "\c" to prevent <newline>

read param

echo param=$param

When we run this script it prompts for input and then echoes the results:

$ ./read.sh

Input a phrase hello frank # I type in hello frank <return>

param=hello frank

Introduction to Unix - 14 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]