#!/bin/bash printf "%s" "${1}" | grep "^-\?[0-9.]\+$">/dev/null || exit 1 curval="$(xrandr --verbose | grep -o "Brightness: [0-9.]\+" | grep -o "[0-9.]\+")" [ $(bc -l <<< "scale=1;${curval}>=0.3") -eq 1 ] &&\ [ $(bc -l <<< "scale=1;${curval}<=2") -eq 1 ]\ && curval="$(bc -l <<< "scale=1;${curval}+${1}")" xrandr --output LVDS1 --brightness "${curval}"