Jan Kundrát | 288f6af | 2018-09-21 14:58:04 +0200 | [diff] [blame] | 1 | #!/bin/bash |
2 | |||||
3 | LEDS=(NONE status:{red,green,blue} uid:{red,green,blue} line:{red,green,blue} sfp:{red,green,blue}) | ||||
4 | |||||
5 | LAST=${#LEDS[@]} | ||||
6 | let "LAST2 = $LAST - 1" | ||||
7 | echo $LAST2 | ||||
8 | |||||
9 | for NUM in $(seq 1 ${LAST}); do | ||||
10 | let "PREVIOUS = $NUM - 1" | ||||
11 | if [[ $PREVIOUS -ne NONE ]]; then | ||||
12 | echo 0 > "/sys/class/leds/${LEDS[$PREVIOUS]}/brightness" | ||||
13 | fi | ||||
14 | if [[ $NUM -ne $LAST ]]; then | ||||
15 | echo 255 > "/sys/class/leds/${LEDS[$NUM]}/brightness" | ||||
16 | fi | ||||
17 | sleep 0.3 | ||||
18 | done |