Skip to content

Instantly share code, notes, and snippets.

Created February 21, 2014 15:06
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