The read command is used to read text from the keyboard or standard input. Read user input in interactive form. The "enter key" is used as the end by default. It is generally used in automated sh scripts. # Use non-Echo (non-echoed) to read the password $ read-svar # display prompt information $ read-p "Enterinput: "var # read input at a specific time (unit: Seconds) $ read-t2var # custom Terminator
The read command is used to read text from the keyboard or standard input. Read user input in interactive form. The "enter key" is used as the end by default.
It is generally used in automated sh scripts.
# Use non-Echo (non-echoed) to read the password
$ Read-s var
# Display prompt information
$ Read-p "Enter input:" var
# Read input within a specific period of time (unit: Seconds)
$ Read-t 2 var
# Custom Terminator (that is, end when a colon (:) is entered)
$ Read-d ":" var
# Read 5 characters and store the variable var
$ Read-n 5 var