mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-02-03 15:43:34 +00:00
22 lines
500 B
Plaintext
22 lines
500 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, common]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# read
|
|
|
|
> Shell builtin for retrieving data from `stdin`.
|
|
> More information: <https://manned.org/read.1p>.
|
|
|
|
- Store data that you type from the keyboard:
|
|
|
|
`read {{variable}}`
|
|
|
|
- Do not let backslash (\) act as an escape character:
|
|
|
|
`read -r {{variable}}`
|
|
|
|
- Read `stdin` or file and perform an action on every line:
|
|
|
|
`while read line; do {{echo|ls|rm|...}} "$line"; done < {{/dev/stdin|path/to/file|...}}`
|