#!/bin/sh brightness_dir="/sys/class/backlight/intel_backlight/brightness" max_brightness=`cat /sys/class/backlight/intel_backlight/max_brightness` current_brightness_level=`cat $brightness_dir` new_brightness_level=`expr $current_brightness_level + $1` if [ "$1" -ge 0 ]; then if [ "$new_brightness_level" -le "$max_brightness" ]; then echo $new_brightness_level > $brightness_dir else echo $max_brightness > $brightness_dir fi else if [ "$new_brightness_level" -ge 0 ]; then echo $new_brightness_level > $brightness_dir else echo 0 > $brightness_dir fi fi