shell:读取文件的每一行内容并输出
写法一:输入重定向
#!/bin/bash
while read line
do
echo $line
done < file(待读取的文件)写法二:管道命令
#!/bin/bash
cat file(待读取的文件) | while read line
do
echo $line
done写法三:
for line in `cat file(待读取的文件)`
do
echo $line
done 相关推荐
laisean 2020-11-11
zhangjie 2020-11-11
大牛牛 2020-10-30
firefaith 2020-10-30
liguojia 2020-10-20
wangzhaotongalex 2020-10-20
CARBON 2020-10-20
JohnYork 2020-10-16
xiaonamylove 2020-10-16
Julyth 2020-10-16