Skip to content

Instantly share code, notes, and snippets.

@Steffo99
Created May 31, 2019 08:02
Show Gist options
  • Save Steffo99/6dca64b58c72079474afd8d2a6e96e6d to your computer and use it in GitHub Desktop.
Save Steffo99/6dca64b58c72079474afd8d2a6e96e6d to your computer and use it in GitHub Desktop.
#!/bin/bash
MAX_BRIGHTNESS=$(cat /sys/class/backlight/nvidia_0/max_brightness)
if [[ $1 -lt 0 ]]; then
echo "Error: brightness must be in range [0-$MAX_BRIGHTNESS]"
exit 1
elif [[ $1 -gt $MAX_BRIGHTNESS ]]; then
echo "Error: brightness must be in range [0-$MAX_BRIGHTNESS]"
exit 2
fi
echo $1 > /sys/class/backlight/nvidia_0/brightness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment