1

My attempt is this: If a certain USB-device is plugged in, I want to open a gnome-terminal window in my desktop-environment. This newly opened window must be able to be interactive, this means, the script, which, besides, opens the window, must then be able to read from stdin, in order to react to user commands. I managed to open the gnome-terminal as a part of my script, which runs on the specifoc udev-rule. First I exported the display, then I ran "gnome-terminal". Now I want immediately to echo from this script to the newly opened terminal.

From what we can get out of here

http://www.reactivated.net/writing_udev_rules.html

udev seems not to be intended for this. The script seems not to know, that it has been invoked in the context of a shell.

From what I could read here

https://superuser.com/questions/198015/open-gnome-terminal-programmatically-and-execute-commands-after-bashrc-was-execu

and here

https://askubuntu.com/questions/5363/how-to-start-a-terminal-with-certain-text-already-input-on-the-command-line

there are some ideas, on how to achieve some similar thing like what I want, via pipes. But there is nothing mentioned about a udev-rule bing the initial invoker.

The question still remains:

Is it still possible in a kind of combined approach to open a gnome-terminal on an udev-rule, and pass, as a first step, a string to it, for prompting let's say: "Target device was plugged in. Enter "a" or "b or "c".

Can these approaches generally be combined ? This seems to be one result, which I could already answer, but it deals with a helper-application

https://stackoverflow.com/questions/31408021/notify-send-not-working-in-script-executed-from-udev.

I would like to achieve it with the usage of more deeper technique, also to get in touch with the technical background of challanges like this.

Or is the simple answer NO. You can't ? ( though hard to believe, in an such highly customizable os, what linux really is ).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.