I made a little program to manage the brightness of the screen for my laptop. the problem is that when i overwrite the BRIGHTNESSCTRL variable, well, i overwrite it and the previous value is erased, so when i use the program always it sets the brightness to 20000, any help is appreciated. By the way this is my program.
#!/bin/bash
echo 'Actual brightness:' ; cat /sys/class/backlight/intel_backlight/actual_brightness
cat /sys/class/backlight/intel_backlight/actual_brightness > BRIGHTNESSCTRL
let "BRIGHTNESSCTRL=BRIGHTNESSCTRL+10000"
if [[ $BRIGHTNESSCTRL -gt 96000 ]] ; then BRIGHTNESSCTRL=96000 ; fi && echo 'Success' || echo 'Failure'
echo $BRIGHTNESSCTRL
sudo echo $BRIGHTNESSCTRL > /sys/class/backlight/intel_backlight/brightness ; echo $BRIGHTNESSCTRL