管道技巧-while read line
2020-06-20 11:30
906 查看
钉钉、微博极速扩容黑科技,点击观看阿里云弹性计算年度发布会!>>>
一 、重定向法;管道法: cat $FILENAME | while read LINE
Function While_read_LINE(){
cat $FILENAME | while read LINE
do
echo $LINE
done
}
注释:我只所有把这种方式叫做管道法,相比大家应该可以看出来了吧。当遇见管道的时候管道左边的命令的输出会作为管道右边命令的输入然后被输入出来。
二、实例
1、pri.sh
#!/bin/bash cat ~/xieco/dirls | while read dd do echo "chown -R test:test ${dd}" chown -R deuser:deuser ${dd} done
2、dirr
/usr/local/htdocs/dcserver/utilserver/ /usr/local/configs/
3、执行 sh pri.sh
相关文章推荐
- 管道技巧-while read line
- 管道技巧-while read line
- 管道技巧-while read line
- 管道技巧-while read line
- 【shell】while read line 与for循环的区别
- while read line无法循环read文件
- while read line - [linux学习]
- Shell script - while read line后面的行读不出来
- [shell]while read line do done < file
- 关于while read line循环的linux bash shell bug
- [shell] while read line 与for循环的区别
- 【shell】while read line 与for循环的区别
- while read line 与 for 区别
- while read line 用法详细介绍
- while ((read = getline(&line, &len, fp)) != -1)
- Bash 解决while read line无法读取最后一行的问题
- Suse linux脚本中使用while read line读取文件内容
- 偶遇bash 的while read line 的问题
- while read line
- 当while read line 遇到 ssh