0
点赞
收藏
分享

微信扫一扫

linux循环之while逐行读取输出


shell脚本:while-read-line.sh

#!/bin/bash
#date:2024/9
#description:while read line

while read line
do
 echo $line
done </root/test.txt

输出

[root@patrolagent ~]# cat test.txt 
1,11,ztj1
2,22,ztj2
3,33,ztj3
4,44,ztj4
[root@patrolagent ~]# sh while-read-line.sh 
1,11,ztj1
2,22,ztj2
3,33,ztj3
4,44,ztj4
[root@patrolagent ~]#

举报

相关推荐

0 条评论