wait_for_user 练笔
vi p150
1 #wait_for_user user [time]
2
3 wait_for_user () {
4 until who | grep "$1" > /dev/null
5 do
6 sleep ${2:-3}
7 echo "imasleep "
8 done
9 }
10
ohoh~
去掉行号 :set nonu
#wait_for_user user [time]
wait_for_user () {
until who | grep "$1" > /dev/null
do
sleep ${2:-3}
echo "imasleep "
done
}
chmod +x p150
. ./p150 (source一下)
可以调用函数了
wait_for_user root