diff options
Diffstat (limited to 'bin/bright')
-rwxr-xr-x | bin/bright | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -39,6 +39,21 @@ inc_b() set_b ${b} } +tog_b() +{ + local b= + + b=$(get_b) + case ${b} in + [0-9] | [1-4][0-9]) + set_b 100;; + [5-9][0-9] | 100) + set_b 0;; + esac + + return 0 +} + usage() { printf 'Usage: %s {<direction>|<value>}\n' "${0}" @@ -46,6 +61,7 @@ usage() printf 'Where <direction> is any word beginning with (in any case):\n' printf ' * "U" for up\n' printf ' * "D" for down\n' + printf ' * "T" for toggle (between 0 and 100)\n' printf 'And <value> is any integer between 0 and 100 inclusive\n' return 0 @@ -66,6 +82,7 @@ main() case "${dir}" in [Uu]*) inc_b 20;; [Dd]*) inc_b -20;; + [Tt]*) tog_b;; *[!0-9]* | '') usage 1>&2 return 1 |