On Wed, 27 Feb 2008, Kathryn Hogg wrote:

> Mike Miller wrote:
>> So then, does Kathryn's method always work? (with quotes around $0):
>>
>> (cd $(dirname "$0"); pwd)
>>
>> I think maybe it does.  It is an elegant solution.
>
> That definitely won't work.  It will fix the dirname but then cd would see
> something like
> cd /yes/i am/stupid.  so we need to quote the arguments to both dirname
> and cd.

Yep, I forgot that too.  Quotes are needed...

cd "you/are smarter/than/me"

Mike