将文件行读入数组

readarray -t arr <file

或者循环:

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