Unable to execute .sh

Hi,

I'm running Zorin 17.3 Core.

i have lot of .sh scripts for years for easy launch customs commands, but i'm facing an issue : right now it just doesn't execute in terminal or like a program (no popup at all).

When double clicking a .sh file, it just opens in text editor.

Chmod +x is ok (and it's check on file properties).

If i try to change in properties the default app, i just can't find gnome-terminal in the list...

I tried several solutions.. Without success.

1° adding

application/x-shellscript=gnome-terminal.desktop to ~/.config/mimeapps.list

=> Still opening in text editor

2° Executed xdg-mime default gnome-terminal.desktop application/x-shellscript

=> Still opening in text editor

What is going on ??

And when You open the Terminal and run the Script in the Terminal does this work?

right click -> run as program

1 Like

The only time I have used .sh was to install MultiSystem USB creator which has 'install' as part of its name:

sudo ./install-depot-multisystem.sh

No, open the Terminal and then type cd [Path-To-The-Script] and then type ls to see that You see the Script and You are really right where You are.

And then You can use the Blueprint from @swarfendor437 to run the Script. Depending what Script it is, You maybe don't need the sudo.

yes, and @nicNiz right click run as program works too.

The scirts are dedicated to run local program, without sudo.

I've marked @nicNiz's reply as the solution; that is the easiest way to handle this. It's also safer, depending on the content of the script, as you wouldn't want to run certain actions accidentally.

Another way would be creating .desktop files that act as launchers for whatever custom command you want to run. This is part of the freedesktop specification, and my personal preferred way to deal with running scripts through a GUI.
If you rely on these scripts, you should go for this approach as you can then specify additional parameters such as the running directory.

Or, more natural to this type of file, run through terminal.