#!/bin/sh path="(enter a path to this script)" function ask() { echo -n "$1 (y/N): " read reply [ "x$reply" == "xy" ] } script="backlight_control.sh" if [ ! -x /usr/sbin/vbetool ] then echo "Installing required vbetool ..." sudo yum -y install vbetool sudo chmod +s /usr/sbin/vbetool fi target="$HOME/.bashrc" if $(grep -q $script $target) then if ask "Backlight control is enabled, disable" then temp=$(mktemp) grep -v $script $target > $temp mv $temp $target killall $script > /dev/null 2>&1 else echo "No action taken." fi else if ask "Backlight control is disabled, enable" then echo "$path/$script &" >> $target nohup ./$script > /dev/null 2>&1 < /dev/null & else echo "No action taken." fi fi