0

I'm writing a couple-lines file of bash scripts that launches a Mono application, but when I double click the file, it asks whether I want to run, run in terminal, or display contents--how do I set the file to run automatically, without this pop-up? I'm trying to reduce as many steps as I can for an end-user.

The pop-up in question's specifics:

  • Title text: "Do you want to run (filename, no extension), or display its contents?"
  • Subtext: "(filename,no ext) is an executable text file."
  • Options: Run in Terminal, Display, Cancel, Run (Except display also runs it...)

System: Mint 19

  • Batch file? that sounds like a windows thing. Do you mean Bash script? – Josh Beauregard Oct 10 at 16:06
  • new to Linux--I believe that's what I mean, yeah. I have a text file with bash scripts in it. – rllogan Oct 10 at 16:10
  • I wouldn't double-click an icon. I would open Terminal, cd to the directory and enter bash ./script.sh to execute it. – glenn jackman Oct 10 at 16:12
  • ultimately, this is for an end-user who won't do anything but start the app off the desktop, and probs won't know anything about Linux--thus the shortcut. – rllogan Oct 10 at 16:14
  • Your question is off-topic here, please ask over on Unix & Linux instead. – dessert Oct 10 at 16:27
1

Create a launcher. Open a text file and paste:

[Desktop Entry]
Name=foo
Exec=/path/to/your/script
Icon=
Type=Application

Now double click on it, it should do the trick. Maybe a pop-up will show, to mark as a trusted app, but just once.

  • what does the .desktop extension do for the system? – rllogan Oct 10 at 17:01
  • the launcher did it! Seems strange to have a launcher file to a script file to a mono app, but if it gets rid of the pop-up, all is well in the world. – rllogan Oct 10 at 17:04
  • Glad it works. For the desktop extension, I was wrong I think, I will edit the answer accordingly. Right now I'm on mint cinnamon. – guillermo chamorro Oct 10 at 17:07
  • this is the better comment, ignore mine. – Josh Beauregard Oct 10 at 17:08
0

Assuming your file is called something like launch.sh:

  1. Make sure your file has a proper shebang
  2. Rename the file to remove the extension .sh. mv launch.sh launch
  3. Make launch executable. chmod +x launch

This should just run without the warning popup.

  • shebang line--check. extension removed--probably? I started with a .txt file, and I don't see an extension in properties. executibility--I did run that line, don't know how to find proof. but the pop-up continues. I'll include more info about the pop-up in the post. – rllogan Oct 10 at 16:21
  • to find proof go into your terminal and run ls SCRIPTNAME it should not have a .sh or .txt at the end. – Josh Beauregard Oct 10 at 16:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.