executing (bash) script via click in Dolphin


I have a script with the following contents:

echo … zipping core
zip tap_checker_core_ -r ./core

which I have saved in a file called “zipit.sh” (and via right click -“properties”-“permissions”, I set the permission to everybody can “read & write” and “Is executable”)

From the terminal in Dolphin I can run the script fine by writing “./zipit.sh” (a zip file gets created in the same dir) However I cant seem to get the script to run (no zip file gets created) when i just click on it in the Dolphin Gui.

Can anybody tell me what I might be omitting to do, or why this isnt working?

Thanks in Advance.

The problem here seems to be that when you click on the script in Dolphin that the script gets a different working dir than the dir the file is in. (Im not sure why this would ever be desirable but it seems to be the case generally).

So adding this to the top of the script to change the working dir is a solution (in case its of help to someone else):

cd $(dirname “$(readlink -nf $0)”)

Im not sure if this is the best (most robust) solution, but it seems to work fine for me. If anybody has better ideas Id be happy to see them.