Bash Read lines of a file into an array


Example

readarray -t arr <file

Or with a loop:

arr=()
while IFS= read -r line; do
   arr+=("$line")
done <file