Dan Armbrust wrote: > I'm trying to find a variable or a command that will tell me where the > currently executing script lives. > > So, If I'm running /foo/bar.sh, I'm looking for a something that will > give me "/foo/", while I'm inside the script bar.sh. > > On windows, this is "%~dp0". > > On Linux you have two options: 1) If you can guarantee that dirname exists then this works: mypath=`dirname $0` cd ${mypath} mypath=`pwd` 2) If you're not sure that dirname exists, this works well: mypath="`echo $0 | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`" cd ${mypath} mypath=`pwd` -- Jon Schewe | http://mtu.net/~jpschewe If you see an attachment named signature.asc, this is my digital signature. See http://www.gnupg.org for more information. For I am convinced that neither death nor life, neither angels nor demons, neither the present nor the future, nor any powers, neither height nor depth, nor anything else in all creation, will be able to separate us from the love of God that is in Christ Jesus our Lord. - Romans 8:38-39