Last active
April 26, 2018 00:14
-
-
Save iNamik/d5c439248b6ae2a0f4d0bb989a8980a3 to your computer and use it in GitHub Desktop.
Bash Script to Set The Brightness on the Raspberry Pi Touch Screen
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 | |
FILE="/sys/class/backlight/rpi_backlight/brightness" | |
if [ $# = 0 ]; then | |
cat ${FILE} | |
exit 0 | |
fi | |
if [ $# -eq 1 ] && [[ $1 =~ ^[0-9]{1,3}$ ]] && [ $1 -ge 0 ] && [ $1 -le 255 ]; then | |
echo $1 > ${FILE} | |
exit 0 | |
fi | |
cmd=$( basename $0 ) | |
>&2 echo "USAGE: ${cmd} [ level (0 to 255) ]" | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment