文章出處

文件名 test28.sh 

#!/bin bash
#  reading data from a file 

count=1
cat test | while read line
do 
  echo "Line $count:$line"
  count=$[ $count + 1]
done
echo  "Finshed processing the file"

test文件內內容為:

The quick brown dog jumps over the lazy fox.
This is a test,this is only a test.

運行 sh test28.sh 

輸出:

Line 1:The quick brown dog jumps over the lazy fox.
Line 2:This is a test,this is only a test.

 


文章列表




Avast logo

Avast 防毒軟體已檢查此封電子郵件的病毒。
www.avast.com


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()