#定义array
ptpArray=()
while read line
do
#将文件读取内容放到array中,注意作为字符串放,否则空格会被分隔成行
ptpArray+=("$line")
done < a
#echo "${#ptpArray[@]}"
#for line in "${ptpArray[@]}"
#定义array
ptpArray=()
while read line
do
#将文件读取内容放到array中,注意作为字符串放,否则空格会被分隔成行
ptpArray+=("$line")
done < a
#echo "${#ptpArray[@]}"
#for line in "${ptpArray[@]}"
转载于:https://www.cnblogs.com/kevinge/p/9234811.html