Forrest logo
back to context overview

read

List of commands for read:

  • read:tldr:208c8 read: Read `stdin` and perform an action on every line.
    $ while read line; do echo "$line"; done
    try on your machine
    explain this command
  • read:tldr:3e0c8 read: Store each of the next lines you enter as values of an array.
    $ read -a ${array}
    try on your machine
    explain this command
  • read:tldr:48f7d read: Specify the number of maximum characters to be read.
    $ read -n ${character_count} ${variable}
    try on your machine
    explain this command
  • read:tldr:60397 read: Do not let backslash (\\) act as an escape character.
    $ read -r ${variable}
    try on your machine
    explain this command
  • read:tldr:7ab7f read: Store data that you type from the keyboard.
    $ read ${variable}
    try on your machine
    explain this command
  • read:tldr:ba9b7 read: Do not echo typed characters (silent mode).
    $ read -s ${variable}
    try on your machine
    explain this command
  • read:tldr:c1469 read: Use a specific character as a delimiter instead of a new line.
    $ read -d ${new_delimiter} ${variable}
    try on your machine
    explain this command
  • read:tldr:c1b5b read: Display a prompt before the input.
    $ read -p "${Enter your input here: }" ${variable}
    try on your machine
    explain this command
back to context overview