mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-22 06:22:07 +02:00
readarray: add page (#15248)
Co-authored-by: Wiktor Perskawiec <git@spageektti.cc> Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
This commit is contained in:
parent
b89072d937
commit
4ba2be2fcd
1 changed files with 20 additions and 0 deletions
20
pages/common/readarray.md
Normal file
20
pages/common/readarray.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
# readarray
|
||||
|
||||
> Read lines from `stdin` into an array.
|
||||
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-readarray>.
|
||||
|
||||
- Interactively input lines into an array:
|
||||
|
||||
`readarray {{array_name}}`
|
||||
|
||||
- Read lines from a file and insert them in an array:
|
||||
|
||||
`readarray {{array_name}} < {{path/to/file.txt}}`
|
||||
|
||||
- Remove trailing deliminators (newline by default):
|
||||
|
||||
`readarray -t {{array_name}} < {{path/to/file.txt}}`
|
||||
|
||||
- Copy at most the specified number of lines:
|
||||
|
||||
`readarray -n {{N}} {{array_name}} < {{path/to/file.txt}}`
|
Loading…
Add table
Reference in a new issue