From 4ba2be2fcd59a25a14145b9873f3db0ab4cc7991 Mon Sep 17 00:00:00 2001 From: Managor <42655600+Managor@users.noreply.github.com> Date: Sun, 29 Dec 2024 00:31:56 +0200 Subject: [PATCH] readarray: add page (#15248) Co-authored-by: Wiktor Perskawiec Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> --- pages/common/readarray.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 pages/common/readarray.md diff --git a/pages/common/readarray.md b/pages/common/readarray.md new file mode 100644 index 000000000..64967bae9 --- /dev/null +++ b/pages/common/readarray.md @@ -0,0 +1,20 @@ +# readarray + +> Read lines from `stdin` into an array. +> More information: . + +- 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}}`