0

I have a bash script in my_script.sh. The settings for it are these:

enter image description here

and in the terminal using ls -lh:

-rwxr-xr-x. 1 blah blah  44 Aug  1 10:51 my_script.sh

When I do right click → Run as a program, as shown below:

enter image description here

nothing happens. However, when I open a terminal and run ./my_script.sh, it works as expected.

What am I doing wrong in the graphical interface side?

In case it is relevant, this is the content of the script:

#!/usr/bin/env bash

firefox www.google.com

I am using "Files 46.2":

enter image description here

1 Answers1

0

Nautilus has a script directory that you can install files to point at your scripts. When there is a file in the directory it will add an extra Scripts menu right click option.

${HOME}/.local/share/nautilus/scripts

(If you use Run as a Program menu option and point at this directory it will also run the scripts.)

A typical file would look like this: -

#!/bin/bash
sscript="/home/xxxxx/Documents/scripts/sh/ShowLeak/showleak.sh"
gnome-terminal -e $sscript

If you change line 3 to gnome-terminal -e $1 then when you run the script it will put up a terminal in edit mode. In this mode you can add the script path/file directly so you don't have to add anything to the file at all. There are also a number of other things you can change.

The following link give loads of other options which you might find interesting - including some scripts to try.

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

david
  • 937