2

I want to create a script that automatically downloads a zip from the internet like the following sh script named test.sh :

#!/usr/bin/env bash 
curl -o csvs.zip https://randomCloudCsv/download

But I want to run it with double click and not with

./test.sh

from the terminal

I was thinking that defining this behaviour would also require another script that makes this preference specific only for this script as it would be dangerous to be a default for every random script. My question is similar with that How to execute a script just by double clicking like .EXE files in Windows? but I'll keep the question here as the answer I got is more straightforward (notice that the other question is also editied and at the beggining it didn't look like mine)

1 Answers1

3

Create a .desktop file, its about-like a windows .lnk

Create the file on the desktop
nano $(xdg-user-dir DESKTOP)/mylauncher.desktop
And paste the following text in the desktop file

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec='/path/to/your/script.sh'
Name=Give it a Name
Comment=Why not add some comment
Icon=/path/to/an/icon/for/the/launcher.svg

Make the .desktop file executable
chmod +x $(xdg-user-dir DESKTOP)/mylauncher.desktop

You can find icons under /usr/share/icons/

Aaron
  • 5
cmak.fr
  • 8,696