[seesea@UC ~]$ cat a.txt
1
2
3
4
a
b
c
d
[seesea@UC ~]$ ar=( $(cat a.txt) )
[seesea@UC ~]$ for (( i = 0; i < ${#ar[@]}; ++i )); do echo "ar[$i] = ${ar[i]}"; done
ar[0] = 1
ar[1] = 2
ar[2] = 3
ar[3] = 4
ar[4] = a
ar[5] = b
ar[6] = c
ar[7] = d
用数组更方便吧。