#!/bin/sh . "lib_common.sh" . "lib_handle.sh" help() { cat << EOF ${0}: Wrapper script to change backlight options: -i [Brg] Increase backlight by Brg -d [Brg] Decrease backlight by Brg -s [Brg] Set backlight to Brg -p Show the current backlight -h Print this message and exit NOTE: Script interprets values as percentages EOF exit 0 } brightness_handle check_program [ ${#} != 1 ] && [ ${#} != 2 ] && invalid_use while getopts "i:d:s:ph" option; do case "${option}" in i) run --reload-status "brightness_handle up ${OPTARG}" ;; d) run --reload-status "brightness_handle down ${OPTARG}" ;; s) run --reload-status "brightness_handle set ${OPTARG}" ;; t) run --reload-status "brightness_handle toggle" ;; p) brightness_handle get-current ;; h) help ;; *) invalid_use -h ;; esac done invalid_use