0

I would like to run a script from the GUI. For example a simple echo "hello" from the right click context menu. In my case I would set up an action in thunar like this:

Thunar Edit Action Window

Then it appears in the context menu and it executes. But I never get to see the output. If the script requires input like for example a password, the window quickly does it's job and then disappears.. Of course this is nonsensical example. But I would like to use it for sending files, scanning for malware etc.

In what kind of way would I have to start the script to get a terminal window with output that stays open to see the result?

2

The exact answer depends on which terminal emulator you are running, as they have different flags to stop them closing once the command finishes executing.

However, you'd want something like this:

/usr/bin/xterm  -hold -e "sh /home/user/echo.sh"

or

xfce4-terminal -H -x "/home/user/echo.sh"

This executes xterm, telling it to 'execute' the sh .... .sh and then not close after running.

YMMV - I've not tested the above code; and you may have a different terminal emulator which uses a different flag to not close.

Reference: How can I make a script that opens terminal windows and executes commands in them?

  • Also, you could just run the terminal and the shell inside the terminal; it wouldn't close until the shell exited. – djsmiley2k - CoW Apr 24 '15 at 10:25
  • I use the xfce4-terminal and when I try this it tells me there is no such file or directory. When I leave sh out it tells me that it doesn't have the right permissions. – TomTom Apr 24 '15 at 10:28
  • Figured it out... you need to set the script as runnable, however the window doesn't hold. – TomTom Apr 24 '15 at 10:31
  • 1
    Alright figured it out for xfce4-terminal: xfce4-terminal -H -x "/home/user/echo.sh". You can add it to your answer. – TomTom Apr 24 '15 at 10:40

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.