Summarizing the read command with options

The following table summarizes various read command-related options that you learned in the previous sections:




This command will read text from a keyboard and store the received text in a built-in variable REPLY.

read value

This reads text from a keyboard or standard input and stores it into the variable value.

read first last

This will read the first word in a variable first and the remaining text of the line in a variable last. The first word is separated by white space from the remaining words in the line.

read -e

This is used in interactive shells for command-line editing. If vi editor is used, then vi commands can be used.

read -a array_name ...

Get Learning Linux Shell Scripting - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.