Read lines from a file into a Bash array [duplicate]

The readarray command (also spelled mapfile) was introduced in bash 4.0.

readarray -t a < /path/to/filename

Leave a Comment