the following code does not work properly and always prints the echo
from the first elif
. this is running on a bbb. would anyone be able to find the error i know its something stupid but i can't find it.
#!/bin/bash
#bashUSR.sh
path=/sys/class/leds/beaglebone:green:usr
echo "starting the LED bash script."
if [ "$#" == 0 ]; then
echo "to few arguments. enter either 0 or 1 followed by on or off."
exit 2
elif [ "$2" != "on" ] || [ "$2" != "off" ]; then
echo "invalid second argument. please input either on or off."
elif [ "$1" == "0" ] && [ "$2" == "on" ]; then
echo "turning on usr0 LED."
export path0/brightness 1
elif [ "$1" == "0" ] && [ "$2" == "off" ]; then
echo "turning off usr0 LED."
export path0/brightness 0
elif [ "$1" == "1" ] && [ "$2" == "on" ]; then
echo "turning on usr1 LED."
export path1/brightness 1
elif [ "$1" == "1" ] && [ "$2" == "off" ]; then
echo "turning off usr1 LED."
export path1/brightness 0
else
echo "invalid user number. please input a number between 0 and 1."
fi