Read file lines into array safely bash

mapfile -t strips newlines; handles spaces unlike for-loop word splitting

mapfile -t lines < file.txt; printf '%s\n' "${lines[@]}"