Resolved: [PLUG] Starting a Shell Script from Konqueror'sFileBrowser

Terry Griffin griffint at pobox.com
Wed Apr 11 22:45:10 UTC 2007


> On Wed, 11 Apr 2007, Terry Griffin wrote:
>
>> It's possible to solve this in the script by having the script
>> determine it's own location and then cd'ing to it.
>>
>>  #!/bin/sh
>>  self=`which $0`
>>  mydir=${self%/*}
>>  cd $mydir
>
> That'll only work if which finds $0 in the current $PATH, right? How
> about this instead:
>
>    cd $(dirname $0)
>

No, 'which' still figures it out, even if $0 contains a full or
relative path.

But dirname works too.

Terry




More information about the PLUG mailing list