Guest User

Untitled

a guest
Jun 24th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ $# -eq 1 ];
  4. then
  5. PAST=`cat /sys/class/backlight/acpi_video0/brightness`
  6. CURRENT=$PAST
  7.  
  8. if [ $1 == "inc" ];
  9. then
  10. if [ $CURRENT -lt 10 ];
  11. then
  12. ((CURRENT++))
  13. fi
  14. elif [ $1 == "dec" ];
  15. then
  16. if [ $CURRENT -gt 1 ];
  17. then
  18. ((CURRENT--))
  19. fi
  20. elif [ $1 == "get" ];
  21. then
  22. echo $PAST
  23. elif [ $1 -ge 1 ] && [ $1 -le 10 ];
  24. then
  25. CURRENT=$1
  26. fi
  27.  
  28. if [ $CURRENT != $PAST ];
  29. then
  30. tee /sys/class/backlight/acpi_video0/brightness <<< $CURRENT > /dev/null
  31. fi
  32. fi
Add Comment
Please, Sign In to add comment