Instantly share code, notes, and snippets.

anonymous /gist:9135830
Created Feb 21, 2014

Embed
What would you like to do?
#!/usr/bin/perl -w
$keybLevel=`ioreg -n "AppleBluetoothHIDKeyboard" | grep -i "batterypercent"`;
chomp ($keybLevel);
$keybLength=length ($keybLevel);
$keybLevel=substr($keybLevel,($keybLength-2),3);
print "<result>$keybLevel</result>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment