User input (Bash)
man read doesn't exist, but you can use
read in direct mode:
$ read blub; echo $blub hallo ← User input hallo ← Echod back to console
read is probably more relevant in a script than in direct mode:
#!/bin/bash read response echo "Response: $response
When executing this script, there is just a blinking prompt. Input is subsequently echod.
#!/bin/bash read -p "Please type something" response echo "Response: $response
-p indentifies the next argument as prompt. Without this flag, an error would occur.
Including silent prompt
Nice of asking for e.g., a password:
#!/bin/bash read -ps "Password?" response
No man page seems to exit, but sometimes (like through
read -help) some help can be get:
read: usage: read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]