iopsys-feed/peripheral_manager/files/sbin/ledctl
Erik Karlsson 8816c26e2a Use correct ranges with tr
The tr command does not take regular expressions and should not be
used with ranges such as [a-z] which furthermore can cause issues if
unquoted as they are interpreted by the shell.
2021-12-15 13:08:18 +00:00

19 lines
286 B
Bash
Executable file

#!/bin/sh
usage () {
echo "Usage: ledctl [normal|test|allon|alloff|production]"
exit 1
}
[ $# -ne 1 ] && usage
ledstate=$(echo $1 | tr 'A-Z' 'a-z')
case $ledstate in
normal|test|allon|alloff|production)
ubus call leds set "{\"state\" : \"$ledstate\"}"
;;
*)
usage
;;
esac