shell小技巧速记

1、读取文件中的内容到数组中.

while read buf  
do
  tArray[$c]=$buf
  c=$(expr $c + 1)
done < aa.txt    #文件名是aa.txt

for ((i=0;i<$c;i++))
do
  echo ${tArray[$i]}
done

  

posted @ 2017-06-01 17:08  掉头发的666  阅读(150)  评论(0编辑  收藏  举报