將檔案行讀入陣列

readarray -t arr <file

或者迴圈:

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