changed to tertiary operator

pull/708/head
jayfan0 2023-04-02 23:04:25 +01:00
parent 8fea2d54a9
commit 1f3cd9035d
1 changed files with 3 additions and 6 deletions

View File

@ -12,8 +12,7 @@ help() {
setRed() {
if [ -n "$GPIO_RED" ]; then
[ $1 -eq 1 ] && gpio set "$GPIO_RED"
[ $1 -eq 0 ] && gpio clear "$GPIO_RED"
[ $1 -eq 1 ] && gpio set "$GPIO_RED" || gpio clear "$GPIO_RED"
else
echo "Red GPIO undefined"
fi
@ -21,8 +20,7 @@ setRed() {
setGreen() {
if [ -n "$GPIO_GREEN" ]; then
[ $1 -eq 1 ] && gpio set "$GPIO_GREEN"
[ $1 -eq 0 ] && gpio clear "$GPIO_GREEN"
[ $1 -eq 1 ] && gpio set "$GPIO_GREEN" || gpio clear "$GPIO_GREEN"
else
echo "Green GPIO undefined"
fi
@ -30,8 +28,7 @@ setGreen() {
setBlue() {
if [ -n "$GPIO_BLUE" ]; then
[ $1 -eq 1 ] && gpio set "$GPIO_BLUE"
[ $1 -eq 0 ] && gpio clear "$GPIO_BLUE"
[ $1 -eq 1 ] && gpio set "$GPIO_BLUE" || gpio clear "$GPIO_BLUE"
else
echo "Blue GPIO undefined"
fi