【shell】Linux shell之while循环
发布时间:2020-12-15 19:39:24 所属栏目:安全 来源:网络整理
导读:while和for一样都是循环语句,相对来说,for循环用的会比较多一点。但是while循环在读取文件行的时候会特别好用。 while 格式 while [ 条件 ]do 内容done 实例:判断i是否小与等于5,如果小于等于5则打印i的值 i=1while [ $i -le 5 ]do echo $i i=$(($i+1))d
while [ 条件 ] do 内容 done
i=1 while [ $i -le 5 ] do echo $i i=$(($i+1)) done [root@XiaoPeng scripts]# bash while.sh
#!/bin/bash - while read line do echo $line done<a.txt [root@XiaoPeng scripts]# bash whileline.sh 版权所有:arppinging (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容