Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 02 Jul 2000 16:13:44 -0500
From:      Jon Hamilton <hamilton@pobox.com>
To:        R Joseph Wright <rjoseph@mammalia.org>
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: making shell script run in its own directory 
Message-ID:  <20000702211344.38B1216F@woodstock.monkey.net>
In-Reply-To: Your message of "Sun, 02 Jul 2000 13:09:01 PDT." <20000702130901.A66305@manatee.mammalia.org> 

next in thread | previous in thread | raw e-mail | index | archive | help

In message <20000702130901.A66305@manatee.mammalia.org>, R Joseph Wright wrote:
} How do I make a shell script run in the directory where it resides rather tha
} n
} the directory where it was called from?

Before you do anything interesting in the script, add a line like:

cd $(dirname $0)

Though generally I consider this kind of thing bad practice.

-- 
   Jon Hamilton  
   hamilton@pobox.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000702211344.38B1216F>