(SOLVED) Launching Bash Script from Desktop Icon

I’ve run into a problem that I haven’t been able to find the answer to yet (None of the Google answers that I could find directly addressed this). When I drag an executable Bash script to my desktop and try to launch it, it gives a start icon for about 30 seconds and ultimately does nothing. When I do the same with a Python script, the Python script executes.

I have a number of Bash scripts that I use regularly. I’d like to be able to execute them from an icon on the desktop rather than have to open Dolphin, find the file, and execute it from there.

I suspect that this is just a parameter somewhere. Oh, yeah, I have set the icons as executable on the desktop and have permission to execute.

Can someone please tell me what I’m missing? Thanks in advance.

You’ll need to set the desktop launcher to execute the script in a terminal window.

Okay, please help me understand this response. First, how do I set the desktop launcher to execute the script in a terminal window?

Second, why do I need to open a terminal window when that’s not needed in Dolphin?

Confused and trying to understand.

Thanks.

Never mind, they may just need to be marked executable. However, unless the shell script launches something GUI based, nothing is going to happen, it’s just executing in the background.

Just for clarification, my scripts are marked executable as are the launchers and they don’t execute from the desktop, hence the question about how to get Bash scripts to execute from a launcher icon. I do want the scripts to execute in the background. One does launch a GUI, the other that I’m playing with at the moment just backs up a MySQL table.

Okay, I did find the option to open a terminal in the Advanced tab of the launcher icon. That did work, but gives some weirdness. The one that backs up the MySQL table flashes a terminal window when it executes. Okay, but very different from when it executes under Dolphin. Under Dolphin it just executes in the background. The one that launches a GUI keeps the terminal window open as well as the GUI window. I really don’t want the terminal window to remain open, I don’t need or want it once the GUI has launched.

I’m obviously not understanding something about launchers. Is there a good resource preferably something with examples that you’d recommend?

When you make a launcher on your desktop or in your menu you just creating .desktop file:
http://standards.freedesktop.org/desktop-entry-spec/latest/
https://linuxcritic.wordpress.com/2010/04/07/anatomy-of-a-desktop-file/
https://wiki.archlinux.org/index.php/Desktop_entries

Thanks. Those references are helpful in understanding what the launchers are. I may have missed it, but I didn’t see an answer to my question about Bash scripts needing a terminal to run (or at least apparently so, since they wouldn’t run without that parameter set in the launcher). My Python scripts don’t need that parameter and just run from the launcher. And, the terminal that opens for the Bash script that invokes a GUI stays open even after the GUI comes up. Do you know of a way to make the terminal invisible since I really don’t need a terminal open in either of my cases? I would hope that there is a parameter for the command line invocation of the scripts that tells the terminal to be invisible.

What I’m really not understanding is why I have to invoke a terminal when I launch the script from a desktop icon, but I don’t when I just click on the file in Dolphin. I’d really like the behavior of the launch from the desktop icon to be the same (or as close as can be) to the behavior in Dolphin.

Python is a programming language:
http://en.wikipedia.org/wiki/Python_(programming_language)

Bash or Borne Again SHell is an sh compatible command line shell:
http://en.wikipedia.org/wiki/Bash_(Unix_shell)

A bash script would require the terminal or a terminal window using bash to work.

Thank you for the links. Those are good explanations of the two different programming methods.

I think we’re misunderstanding each other though. My question is not about the differences in executing commands between a programming language and a script language. My question is very specific about the behavior of the Bash script in the two different environments; 1) from a desktop launcher, and 2) from within Dolphin. When I click on the launcher on the desktop a terminal window actually comes up. When I click from within Dolphin none does. In both cases the script actually runs. I would prefer not to see the terminal window. It’s not needed. I don’t have any information coming back to the standard output. Is there a way to prevent the terminal window from appearing when launching from the desktop? If there is not, then what is the difference between the desktop and Dolphin environments that makes me have to have a terminal window in one and not in the other?

I understand that this is a pretty esoteric question and may not have an easy answer. Thanks for your input and attempts to understand what I’m asking.

The HINT is in the name, friend. Bash Scripts require Bash to run.
The problem is that your not understanding the fact that Bash is NOT a programming language, it is a command line shell, just like fish, ksh, etc., or even better from DOS, command.com.

http://en.wikipedia.org/wiki/Shell_(computing)

http://www.gnu.org/software/bash/

I still think we’re misunderstanding each other here.

The question is; why do I have to invoke a terminal window when launching from a desktop icon, but not when I launch from Dolphin?

I somehow stumbled on to a solution. I don’t know why what I did works, only that it does.

This is the solution: I right clicked on the icon. I went to the Application tab. I then clicked the Advanced button there. Under the Startup section there is an entry Enable Launch Feedback. I unchecked that, then just for the hell of it unchecked Run In Terminal. The BASH script now runs perfectly without invoking a terminal.

Thanks for your willingness to work through this with me.

P.S. Playing with the script that launches a GUI I found that I also needed to set the Work Directory Path before it would actually run. For both of these scripts the Work Directory Path was the path to the folder where the BASH scripts reside.