From 0fb86f66f72b6b3e85f14bb70f258640b1dcdfb3 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 22 Aug 2021 19:52:03 -0400 Subject: bin/bright: Keep within range --- diff --git a/bin/bright b/bin/bright index 7aa0801..87126e1 100755 --- a/bin/bright +++ b/bin/bright @@ -54,7 +54,12 @@ main() esac b=$(get_b) || return 1 - set_b $((${b} ${dir} 1)) || return 1 + : $((b += 1)) + : $((b ${dir}= 1)) + [ ${b} -gt 8 ] && b=8 + [ ${b} -lt 1 ] && b=1 + : $((b -= 1)) + set_b ${b} || return 1 return 0 } -- cgit v0.9.1