commit e8355e17a052c45704240be637ecb1c1a017a6b0 Spenser Truex <truex@equwal.com> 2025-09-05 17:34:41 -0700 Fix hack for value 0
intel-backlight | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/intel-backlight b/intel-backlight index 118ea5a..6acdc03 100755 --- a/intel-backlight +++ b/intel-backlight @@ -15,9 +15,9 @@ max=$(< /sys/class/backlight/intel_backlight/max_brightness) min=$((max / 50)) step=$((max / 10)) -if expr "$1" + 0 >/dev/null 2>&1; then #hack! Is a number? - current=$(( ( ($1 * max) / 100 ) < min ? min : ( ($1 * max) / 100 ) )) - #echo $max $current $min +if [[ "$1" =~ ^[0-9]+$ ]]; then + current=$(( ( ($1 * max) / 100 ) < min ? min : (($1 * max) / 100 ))) + echo $max $current $min else case $1 in up) ((current+=step)) ;;