[Solved] How to run shell script with Terminal window from Desktop


the title says it all - is there a way of running a shell script by double clicking it on the desktop, but in a Terminal window to see it’s output?

Right now, the script is run, but no output is given as there is no terminal window.

Maybe I’m just using the wrong approach? I put the script to some location like ~/scripts and make a symbolic link to it on the Desktop.

With kind regards,

There are two approaches. You can give your script an interface with ie hdialog or there’s a Tracker Addon to execute a command.

There’s the newer TrackRunner approach, and the oldie-but-goodie xicon route too.

Thank you very much, will go with xicon!

Hello. Another way is just using two scripts: using the second one to open a Terminal window and pass the first one as a parameter. For example:


Terminal /bin/sh -c ‘/boot/home/Scripts/MyScript.sh;read’

(where the MyScript.sh file contains the script that you want to run).

I was not aware of the other two tools that @Bipolar mention, so I will try them too :slight_smile:

1 Like

If you can run the script like that wouldn‘t it be sufficient to change the shebang line?

#!Terminal /bin/sh -c

Maybe I‘m missing something? Not infront of a Haiku to test atm.

This seems to be a good solution, but needs some tweaking. As the path of the script itself is passed to the command specified by the shebang, your line almost instantely freezes the OS for as long as the script does not terminate (as it recursively creates instances of terminal and finally runs out of pseudo ttys).

After playing around a little bit with your idea, I came up with the following:

#!/bin/sh -c "Terminal /bin/sh $0"

Using this shebang, I was finally able to exactly archieve the behavior I wanted - running a shell script inside a terminal by double-clicking it’s icon on the desktop.


Thanks for the xicon link, Oscar.

The whole webpage of ‘Pete’ was interesting, to discover and see : how different peoples are existing with exciting experiences and memories – connected via such thing as a software, a basic thing, like an OS (basic in that meaning : everyone uses to handle a device).
As my favourite vulcan proverb says :
Infinite Diversity in Infinite Combinations


1 Like

I’m a bit confused on how my version would give a recursion. I’ll test this out on my machine at some point.

Do note that in your example (atleast on haiku) it is sufficient to write “#!sh” instead of “#!/bin/sh” since the interpreter of the shebang line can look in default locations.

The script file is passed to the interpreter as $0. As terminal does no special treatment to the shebang line it recursively starts another terminal and so on. Shells recognize the shebang line in a script.