shell read 文件
阿新 • • 發佈:2018-11-17
cat true line filename read line lena pro oot 內置
cat filename.txt |while read LINE do echo $LINE done # LINE在這裏面只是隨便一個變量,並不是內置 或者 #!/bin/bash while read aa do echo $aa done< filename.txt #這種格式看起來更好
#!/bin/bash myfile=filename.txt count=0 cat $myfile |while read LINE do echo $LINE let count=count+1 echo $count line done
[root@localhost prog]# cat filename.txt This is line number 1 This is line number 2 This is line number 3 This is line number 4 This is line number 5 This is line number 6 This is line number 7 This is line number 8 This is line number 9 This is line number 10
shell read 文件