I've written 2 rules in udev for usb add and removed in 2 files.
SUBSYSTEM=="usb", ACTION=="add", RUN+="/u/usb_added %b"
SUBSYSTEM=="usb", ACTION=="remove", RUN+="/u/usb_remove %b"
I have created two different scripts for these rules that take appropriate action (doing same thing).
I want to combine these rules (and then action script) by passing values (add, remove) and then check in new script by if condition. and then take proper action.
so my question is how i can pass parameters in RUN+= "/u/usb_status ??"
how i will get these parameters in new script and then use in if condition.
thanks in advance.
I solved it by just writing word after executing script.
for example:
SUBSYSTEM=="usb", ACTION=="add", RUN+="/u/usb_added Parameter %b"
So I just used it as:
SUBSYSTEM=="usb", ACTION=="add", RUN+="/u/usb_added ADDED %b"
and in executing script ( in this case usb_added) i got it as follow:
CHECK=$@
Now value of this CHECK is "ADDED" that was actually passed from Udev rule.