Hi, I'm new to bash scripting and programming. Just curious is there a better way of writing the below code? What I want to achieve is that if the variables is either
0 to 9 or
Up or
Down or
Left or
Right then it will run
xdotool key $cmd1 and if its
ok key it will run
xdotool key "Control_L+Alt_L" and all others will run
php /var/www/phpserial/sendSerial.php -c$cmd1 -v$cmd2. Thanks
Code:
case "$rcstate" in
1)
if [ $cmd1 == [0-9] ]; then
xdotool key "$cmd1"
elif [ $cmd1 == Up ]; then
xdotool key "$cmd1"
elif [ $cmd1 == Down ]; then
xdotool key "$cmd1"
elif [ $cmd1 == Left ]; then
xdotool key "$cmd1"
elif [ $cmd1 == Right ]; then
xdotool key "$cmd1"
elif [ $cmd1 == ok ]; then
xdotool key "Control_L+Alt_L"
else
php /var/www/phpserial/sendSerial.php -c$cmd1 -v$cmd2
fi