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
  • Why not just create a desktop icon just like the others on your desktop?
    – jpezz
    Jun 4, 2019 at 13:57

1 Answer 1

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/

Not the answer you're looking for? Browse other questions tagged .