mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
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.
19 lines
286 B
Bash
Executable file
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
|
|
|