Re: problem executing command substitution from udev rules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 2, 2010 at 4:50 AM, J. Bakshi <j.bakshi@xxxxxxxxxxxxxxxxx> wrote:
> On Tue, 2 Nov 2010 12:51:16 +0300
> Andrey Borzenkov <arvidjaar@xxxxxxxxx> wrote:
>
>> On Tue, Nov 2, 2010 at 9:34 AM, J. Bakshi <j.bakshi@xxxxxxxxxxxxxxxxx> wrote:
>> > Âit works well. ÂBut if I try to add command substitution ( with in back-qoutes ) to dynamically collect the user name , it stops working. The rule is like
>> >
>> > ```````````````
>> > ÂACTION=="add", SUBSYSTEM=="input", ENV{ID_CLASS}="mouse", ENV{DISPLAY}=":0.0", ENV{XAUTHORITY}="/home/user1/.Xauthority" ÂRUN+="/bin/su Â`ps aux | grep startx | grep '/bin/sh' | awk '{print $1}'` Â-c "DISPLAY=:0.0 notify-send "test" Â"
>> > Â``````````````````````````
>> >
>>
>> I do not think udev is using shell to start external commands. You
>> will need to use something like
>>
>> RUN+="/bin/sh -c '...'"
>>
>> Quoting will quickly become unmanageable I am afraid :)
>
> Yes, I have tried with that but no success. I used
>
> RUN+="/bin/sh -c '/bin/su user1 -c 'DISPLAY=:0.0 notify-send test''"
>
> and no luck.

Why not just create a script that does what you want and have udev RUN
that? Otherwise, you'll need to work out escaping the multiple levels
of quotes with \.

--
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux