I have a Raspberry Pi running Raspbian 11 Bullseye and I want to make a desktop shortcut for a shell script. I have tried a handful of options so far such as making a .desktop file and using the Main Menu Editor, but nothing seems to work. Is it possible to create a desktop shortcut (that a user can just double click on) for a shell script? I just want to make it easier so that the user doesn't have to open a terminal and type ./run_application.sh
- 59,890
- 31
- 101
- 209
- 101
- 1
2 Answers
This what I do
1 Right click on the desktop and select 'New file'.
2 Enter a name for the new file. Click OK.
3 Open this new (empty) file in a text editor.
4 Paste your script into this.
5 Make sure the file has the right shebang/hashbang at the top like #!/bin/bash or whatever it should be.
6 Save the file from the editor.
7 Right click the icon on the desktop and choose 'Properties'.
8 In 'Properties', ignore 'General' tab and go to the 'Permissions' tab.
9 In Access Control make these settings as needed. I use these:
View Content: Only Owner
Change Content: Only Owner
Execute: Only owner
10 Click OK.
After this the script should run when you double click the icon, if it has not got any errors.
- 1,390
- 7
- 11
-
Thank you @Michael Harvey, is there a way to change it icon ? – Ikram Ben Abdel Ouahab Dec 10 '23 at 22:52
Open the File Manager, navigate to your desired shell script, and left-mouse drag it to your desktop. This will create a shortcut, rather than creating a new script that is stored on your desktop (and potentially doubling your effort whenever you want to update your script).
- 1