08-31-2017, 03:58 PM
(This post was last modified: 08-31-2017, 04:02 PM by MarkHaysHarris777.)
Ok, expanding on a theme, I have combined the scripts here into one script that takes two parameters; the first is the direction ( U for up; D for down ) and the second is the scalar value.
lcd_bright.sh
Code:
#!/bin/bash
MODE=`echo $1 |tr '[a-z]' '[A-Z]'`
LCDVALUE=`cat /sys/class/backlight/lcd0/brightness`
if [ "$MODE" = "U" ]
then
NEWVALUE=$(( $LCDVALUE + $2 ))
if [ $NEWVALUE -le 100 ]
then
echo $NEWVALUE > /sys/class/backlight/lcd0/brightness
echo $NEWVALUE
else
echo $LCDVALUE
fi
else
NEWVALUE=$(( $LCDVALUE - $2 ))
if [ $NEWVALUE -gt 30 ]
then
echo $NEWVALUE > /sys/class/backlight/lcd0/brightness
echo $NEWVALUE
else
echo $LCDVALUE
fi
fi
Run the script with :
sudo -i
./lcd_bright.sh U 10
or
./lcd_bright.sh D 10
Notes:
The U and D can be upper or lower case ( the script upper cases it for you ).
The script might be changed to set a maximum or minimum based on parameter-- try it !
marcushh777
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )