I have a bash script that configures my USB controller to act like an Xbox 360 controller for use with Steam. Here is the current script:
#!/bin/bash
lsmod | grep xpad
sudo xboxdrv --evdev /dev/input/event14 --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y --axismap -Y1=Y1,-Y2=Y2 --evdev-keymap BTN_TOP=x,BTN_TRIGGER=y,BTN_THUMB2=a,BTN_THUMB=b,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE=lt,BTN_BASE2=rt,BTN_BASE5=tl,BTN_BASE6=tr --mimic-xpad --silent &
exit 0
I would like to add some sort of "if" "else" statement to say that if the script is successful then notify me that it worked. But I don't know how I would do it.
e.g
if "script runs fine" then notify-send -t 2000 USB controller connection successful else "do nothing"
My questions are:
1.Would I need 2 seperate scripts? i.e one to run the first, the other to read the output of that script and produce the notification, or can I do it all in the same script?
2.How do I read that output?
Generally after it has created the new event in the terminal after the script runs, it will tell me the new event number (usually event15). If not it flags up an error.
Any help will be greatly appreciated,
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire