Think before you speak, read before you think.

bash while循环

每0.01秒curl一下某网址

while true ; do curl http://192.168.1.26/status; sleep 0.01;done

逐行输出某日志文件

cat 20131106_access.log1 | while read LINE; do echo $LINE; sleep 0.01 ; done

checkCaps.sh检测CapsLock是否变化

#!/bin/bash
while true
do
    stat="`/usr/bin/xset -q | grep Caps | awk '{print $4}'`"
    if [ "$stat" == "$statswap" ];then
        echo 
    else
        /usr/bin/notify-send  "Capslock changed"
    fi
    statswap=$stat
done

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *