Sample Header Ad - 728x90

Getting the current path in .desktop EXEC command

10 votes
5 answers
13766 views
Im trying to make a .desktop file run a .sh which is stored in the same directory as the .desktop. The whole directory needs to be portable and moved from machine to machine. my run script is run.sh I've tried: [Desktop Entry] Type=Application Terminal=true Name=RunMe #Exec=sh -c "dirname %k/run.sh" #Exec=bash -c "export PATH=$PATH:dirname %k; bash run.sh;" #Exec=bash -c "export PATH=$PATH:dirname %k; sh run.sh;" Exec=bash -c "export PATH=$PATH:dirname %k; run.sh;" But nothing happens when I double click the .desktop file. If I double click 'run.sh' and choose 'run' the script runs fine. If I run the script from the command line with 'sh run.sh' it works fine. Any ideas, even just how I could debug which path its actually trying to run from?
Asked by Kiksy (283 rep)
Jul 14, 2014, 08:31 AM
Last activity: Feb 4, 2025, 11:56 AM