LANGUAGE » SHELL_SCRIPT

Read

Usage

shell
read OPTIONS VAR
OptionDescription
-dContinue until the given character is read, rather than newline.
-rDo not allow backslashes to escape any characters.
-sDo not echo input coming from a terminal (for passwords).
-tTime out in seconds.

Examples

Read a multi-line variable.

shell
read -r -d '' message << EOM
line1
line2
EOM

Read a text from user within 10 seconds.

shell
read -t 10 text

Read a password from user.

shell
read -s password