Results 1 to 2 of 2

Thread: executing (bash) script via click in Dolphin

  1. #1

    Default executing (bash) script via click in Dolphin

    Hello.

    I have a script with the following contents:

    #!/bin/bash
    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.

  2. #2

    Default Re: executing (bash) script via click in Dolphin

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •