Tuesday, June 10, 2014

Bash script to adjust laptop LCD backlight

##!/bin/bash

export blval=`sudo intel_backlight |awk '{print $4}' |sed 's/%//g'`
if  test "$1" = "up"
then
        echo "currrent val : $blval"
        export blval=`expr $blval + 10`
        echo "increase to $blval"
elif test "$1" = "down"
then
        echo "currrent val : $blval"
        export blval=`expr $blval - 10`
        echo "decrease to $blval"


else
        echo  "e.g adj_backlight.sh [ up | down ]"
fi

sudo intel_backlight $blval
exit