我正在嘗試將包含行的文件讀取到Bash數組中。到目前為止,我已經嘗試了以下方法:嘗試1a=( $( cat /path/to/filename ) )嘗試2index=0while read line ; do MYARRAY[$index]="$line" index=$(($index+1))done < /path/to/filename兩次嘗試都只返回一個包含文件第一行的元素數組。我究竟做錯了什么?我正在運行bash 4.1.5
將文件中的行讀取到Bash數組中
慕桂英4014372
2019-12-10 13:08:54