Read (Unix) Explained

read
Operating System:Unix, Unix-like, Inferno
Genre:Command

'''read''' is a command found on Unix and Unix-like operating systems such as Linux. It reads a line of input from standard input or a file passed as an argument to its -u flag, and assigns it to a variable. It is built into shells such as Bash.[1]

Usage

The '''read''' command is used to take input from the user in shell scripts. It has a built in $REPLY variable for storing replies, but can save to other variables.[2]

Configuration

The command supports several options via flags. It can be configured to issue a message using -p instead of needing to use the '''echo''' command. It can also superficially hide text using the -s flag, limit the amount of characters with -n, store the result in an array with -a, and timeout after a certain amount of time with -t.

Notes and References

  1. Web site: 2023-06-08 . Guide to the Linux read Command . 2024-02-16 . Baeldung.
  2. Web site: Murray . Christopher . 2019-10-19 . Linux Read Command: 6 Practical Examples . 2024-02-17 . linuxhandbook.com.