mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-06-07 16:26:02 +02:00
read: add example using 'while' (#5258)
Copied from `while` As discussed in #5258, this replaces a less useful example to maintain the limit of 8 examples per page.
This commit is contained in:
parent
79d8cb64b7
commit
0155fb60ba
1 changed files with 4 additions and 4 deletions
|
@ -10,10 +10,6 @@
|
||||||
|
|
||||||
`read -a {{array}}`
|
`read -a {{array}}`
|
||||||
|
|
||||||
- Enable backspace and GNU readline hotkeys when entering input with read:
|
|
||||||
|
|
||||||
`read -e {{variable}}`
|
|
||||||
|
|
||||||
- Specify the number of maximum characters to be read:
|
- Specify the number of maximum characters to be read:
|
||||||
|
|
||||||
`read -n {{character_count}} {{variable}}`
|
`read -n {{character_count}} {{variable}}`
|
||||||
|
@ -33,3 +29,7 @@
|
||||||
- Do not echo typed characters (silent mode):
|
- Do not echo typed characters (silent mode):
|
||||||
|
|
||||||
`read -s {{variable}}`
|
`read -s {{variable}}`
|
||||||
|
|
||||||
|
- Read stdin and perform an action on every line:
|
||||||
|
|
||||||
|
`while read line; do echo "$line"; done`
|
||||||
|
|
Loading…
Add table
Reference in a new issue