Skip to content

Instantly share code, notes, and snippets.

@iNamik
Last active April 26, 2018 00:14
Show Gist options
  • Save iNamik/d5c439248b6ae2a0f4d0bb989a8980a3 to your computer and use it in GitHub Desktop.
Save iNamik/d5c439248b6ae2a0f4d0bb989a8980a3 to your computer and use it in GitHub Desktop.
Bash Script to Set The Brightness on the Raspberry Pi Touch Screen
#!/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