readarray (built-in Bash command)

Content

 

Data

License: GNU GPLv3 +
Version number: GNU Bash 5
Developer / owner: Free Software Foundation Inc.

Short description:

The manual page and help for the readarray built-in Bash command. The readarray command reads lines from standard input that are placed in an indexed array. The command is a mapfile synonym for command.

 

 

Man page output

man bash
[...]
       mapfile  [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quan-
       tum] [array]
       readarray [-d delim] [-n count] [-O origin] [-s count] [-t]  [-u  fd]  [-C  callback]  [-c
       quantum] [array]
              Read  lines  from the standard input into the indexed array variable array, or from
              file descriptor fd if the -u option is supplied.  The variable MAPFILE is  the  de-
              fault array.  Options, if supplied, have the following meanings:
              -d     The  first  character  of delim is used to terminate each input line, rather
                     than newline.  If delim is the empty string, mapfile will terminate  a  line
                     when it reads a NUL character.
              -n     Copy at most count lines.  If count is 0, all lines are copied.
              -O     Begin assigning to array at index origin.  The default index is 0.
              -s     Discard the first count lines read.
              -t     Remove a trailing delim (default newline) from each line read.
              -u     Read lines from file descriptor fd instead of the standard input.
              -C     Evaluate callback each time quantum lines are read.  The -c option specifies
                     quantum.
              -c     Specify the number of lines read between each call to callback.

              If -C is specified without -c, the default quantum is 5000.  When callback is eval-
              uated,  it  is  supplied the index of the next array element to be assigned and the
              line to be assigned to that element as additional arguments.  callback is evaluated
              after the line is read but before the array element is assigned.

              If  not supplied with an explicit origin, mapfile will clear array before assigning
              to it.

              mapfile returns successfully unless an invalid option or option  argument  is  sup-
              plied, array is invalid or unassignable, or if array is not an indexed array.
[...]

 

 

Help output

readarray --help
readarray: readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]
    Sorok olvasása egy tömbváltozóba.
    
    A „mapfile” szinonimája.

 

Related Content