shell:读取文件的每一行内容并输出
时间:2019-11-03 09:36:09
收藏:0
阅读:74
写法一:输入重定向
1 #!/bin/bash 2 3 while read line 4 do 5 echo $line 6 done < file(待读取的文件)
写法二:管道命令
1 #!/bin/bash 2 3 cat file(待读取的文件) | while read line 4 do 5 echo $line 6 done
写法三:
1 for line in `cat file(待读取的文件)` 2 do 3 echo $line 4 done
原文:https://www.cnblogs.com/FengZeng666/p/11785149.html
评论(0)