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}}`