Created
October 14, 2014 09:56
-
-
Save xurenlu/3031fc21edfe2c2e6f2c to your computer and use it in GitHub Desktop.
检测蓝牙是否连,如果未连接,则挂起系统;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true | |
locked="false" | |
do | |
pair=`bluetoothstatus |grep "renlu" |awk -F ":" '{print $1}'` | |
if [ "${pair}" != "paired" ] ;then | |
echo "connected:" | |
else | |
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend | |
echo "paired:" | |
fi | |
sleep 20 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment