Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jul 2000 14:59:03 -0700
From:      R Joseph Wright <rjoseph@mammalia.org>
To:        Jon Hamilton <hamilton@pobox.com>
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: making shell script run in its own directory
Message-ID:  <20000702145903.A66917@manatee.mammalia.org>
In-Reply-To: <20000702211344.38B1216F@woodstock.monkey.net>; from hamilton@pobox.com on Sun, Jul 02, 2000 at 04:13:44PM -0500
References:  <20000702130901.A66305@manatee.mammalia.org> <20000702211344.38B1216F@woodstock.monkey.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jul 02, 2000 at 04:13:44PM -0500, Jon Hamilton wrote:
> 
> 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.

It works!  Can yourself on that last point?


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?20000702145903.A66917>