htg-public/shell/light.sh

79 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/bash
FILE=""
CURLIGHT=`xbacklight | cut -d '.' -f1`
echo $CURLIGHT
echo $(($CURLIGHT +10))
if [ "$1" = "+" ] ;
then
if [ $CURLIGHT -ge 0 ] && [ $CURLIGHT -lt 10 ]
then
xbacklight =20
elif [ $CURLIGHT -gt 9 ] && [ $CURLIGHT -lt 20 ]
then
xbacklight =30
elif [ $CURLIGHT -gt 19 ] && [ $CURLIGHT -lt 30 ]
then
xbacklight =40
elif [ $CURLIGHT -gt 29 ] && [ $CURLIGHT -lt 40 ]
then
xbacklight =50
elif [ $CURLIGHT -gt 39 ] && [ $CURLIGHT -lt 50 ]
then
xbacklight =60
elif [ $CURLIGHT -gt 49 ] && [ $CURLIGHT -lt 60 ]
then
xbacklight =70
elif [ $CURLIGHT -gt 59 ] && [ $CURLIGHT -lt 70 ]
then
xbacklight =80
elif [ $CURLIGHT -gt 69 ] && [ $CURLIGHT -lt 80 ]
then
xbacklight =90
elif [ $CURLIGHT -gt 79 ] && [ $CURLIGHT -lt 90 ]
then
xbacklight =100
else
xbacklight =100
fi
elif [ "$1" = "-" ] ;
then
if [ $CURLIGHT -ge 0 ] && [ $CURLIGHT -lt 10 ]
then
xbacklight =0
elif [ $CURLIGHT -gt 9 ] && [ $CURLIGHT -lt 20 ]
then
xbacklight =10
elif [ $CURLIGHT -gt 19 ] && [ $CURLIGHT -lt 30 ]
then
xbacklight =20
elif [ $CURLIGHT -gt 29 ] && [ $CURLIGHT -lt 40 ]
then
xbacklight =30
elif [ $CURLIGHT -gt 39 ] && [ $CURLIGHT -lt 50 ]
then
xbacklight =40
elif [ $CURLIGHT -gt 49 ] && [ $CURLIGHT -lt 60 ]
then
xbacklight =50
elif [ $CURLIGHT -gt 59 ] && [ $CURLIGHT -lt 70 ]
then
xbacklight =60
elif [ $CURLIGHT -gt 69 ] && [ $CURLIGHT -lt 80 ]
then
xbacklight =70
elif [ $CURLIGHT -gt 79 ] && [ $CURLIGHT -lt 90 ]
then
xbacklight =80
else
xbacklight =90
fi
else
echo "Invalid argument. expected '+' or '-'"
fi