From b66e7859ec94fcbf76993accd5d2ddffc4c84109 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Thu, 13 Jan 2022 10:22:30 -0500 Subject: [PATCH] [bin] Clean up fade script --- bin/.bin/fade | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/.bin/fade b/bin/.bin/fade index 6b60c68..177ddf4 100755 --- a/bin/.bin/fade +++ b/bin/.bin/fade @@ -1,13 +1,12 @@ #!/bin/bash -hostname=`hostname` -max_brightness=`cat /sys/class/backlight/intel_backlight/max_brightness` -brightness=`cat /sys/class/backlight/intel_backlight/brightness` +max_brightness=$(cat /sys/class/backlight/intel_backlight/max_brightness) +brightness=$(cat /sys/class/backlight/intel_backlight/brightness) step=$(( max_brightness / 8 )) inc=2 low_delta=$(( brightness - step )) high_delta=$(( brightness + step )) -if ( [ $1 = 'down' ] && [ $low_delta -ge $step ] ) || ( [ $1 = 'up' ] && [ $high_delta -le $max_brightness ] ) +if { [ "$1" = "down" ] && [ $low_delta -ge $step ]; } || { [ "$1" = "up" ] && [ $high_delta -le "$max_brightness" ]; } then for i in $(seq $step); do case $1 in @@ -20,5 +19,5 @@ then esac done else - echo 'Brightness too high. Use `off` parameter to turn backlight off' + echo "Brightness too high or low" fi