标签:linux
while
适用于循环次数未知
语法:
while conditions;do
statement
……
done
练习
#!/bin/bash
#
who | grep ‘username‘ > /dev/null
while [ $? != 0 ] ;do
sleep 5
echo `date +T`
who | grep ‘username‘ > /dev/null
done
echo "username is login"
标签:linux
原文地址:http://jiaoxianyao.blog.51cto.com/11369252/1913533