JeSuisNerd

baddery.sh

Apr 20th, 2012
310
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2.  
  3. # script to return the battery time remaining, or status if no time is given.
  4. # ### Requires: acpi package ###
  5.  
  6.  
  7. # Discharging
  8. #############
  9. batt=`acpi -b | grep "Discharging"`
  10. if [[ $batt != "" ]];
  11. then
  12. batt=`echo $batt | awk '{print $5}' | cut -c 1-5`
  13. echo $batt", Discharging"
  14. exit 1
  15. fi
  16.  
  17. # Charging
  18. ##########
  19. butt=`acpi -b | grep "Charging"`
  20. if [[ $butt != "" ]];
  21. then
  22. butt=`echo $butt | awk '{print $5}' | cut -c 1-5`
  23. echo " "$butt", Charging"
  24. exit 1
  25. fi
  26.  
  27. # Fully Charged
  28. ###############
  29. bott=`acpi -b | grep "Full"`
  30. if [[ $bott != "" ]];
  31. then
  32. echo " Fully Charged"
  33. exit 1
  34. fi
  35.  
  36. # Unknown State
  37. ###############
  38. bitt=`acpi -b | grep "Unknown"`
  39. if [[ $bitt != "" ]];
  40. then
  41. echo " -unknown state-"
  42. fi
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×