Execute sh-files in a terminal by double-click, is it possible?

In the settings I have only the option "execute", but if I choose ask all ways, I will get an option box with the additional option "open a terminal and execute".
Is it possible to configure for double click : "open a terminal and execute" (etc, config file) ?

Start Caja file manager. Select Edit > Preferences. Switch to Behaviour tab and select desired action to accompany opening of executable text files.

2 Likes

Yes of course but there is missing the option : "open a terminal and execute".
Its better to see what I mean, set ask all ways what to do, and if done you will get after double click an "option frame" with an option button :"open a terminal and execute"

Now I have found a solution :
Added to script (found at linux mint forum) :

#!/bin/bash

# if the script was not launched from a terminal, restart it from a terminal
if [[ ! -t 0 ]] && [[ -x /usr/bin/mate-terminal ]]; then
	/usr/bin/mate-terminal -e "bash -c \"$0 $*; read -s -p 'Press enter to continue...'\""
	exit
fi


And set in caja "execute" by double click-

A terminal will be opened and the respective script performed.

2 Likes

Glad you have found solution.

I'd like to note that there is such the option named Run in Terminal (UM 22.04):

The caveat is that terminal is immediately closed when a script in question terminates. I.e. the script has to pause its execution. Pausing is usually implemented with read command. It is enough to add read -n 1 -s at the last script line.

1 Like