Run automatically

I placed a lot of these on my desktop to get quickly to a given directory

#!/bin/bash

thunar ~/Scripts

However, every time I double click the icon, there is a popup box that says

Run in Terminal,Display,Cancel, and Run.

Is there a way to get it to “automatically” run ?

It looks like you have a program, in this case a shell script, and not a program launcher. To be exact, that is the dialog you get when opening a text file with the x (execute) permission set.

Thanks.

Gotcha.

I created a laucher instead, so it now runs “automatically.”

For some reason, this will not run as a launcher.

I get “error launching the application.”

#!/bin/bash
# Ubuntu-Mate 16.04
#
#  Run this periodically to clean up unneeded files
#    
echo xxx | sudo -S apt autoremove
echo xxx | sudo -S apt update
echo xxx | sudo -S apt full-upgrade

OK, the formatting now makes it possible to see the correct details.

I’ll guess the file has no “x” (execute) permission. It can be set in the file properties.

It has other issues because the password is piped so interacting with it won’t work and may get stuck. The launcher can be set to “Application in Terminal” to actually see the result.

I set it to execute.

It still won’t run.

I think like you that the piping is causing it to fail.

Ubuntu does not know how to handle it.

My guess is the “sudo” element of the commands. Sudo normally requires that you enter your password. But, by having this built into a launcher and so not offering a terminal in which you can enter your password, when prompted, means it will hang at that point and never fully execute.

I have one method to get round this issue, if you want to know it.

Sure, I would appreciate knowing your method.

See below: