From owner-freebsd-questions Sun Jul 2 14:14:29 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mailgw01.execpc.com (mailgw01.execpc.com [169.207.2.78]) by hub.freebsd.org (Postfix) with ESMTP id 2F78B37B59A for ; Sun, 2 Jul 2000 14:14:26 -0700 (PDT) (envelope-from hamilton@pobox.com) Received: from woodstock.monkey.net (d168.as14.nwbl0.wi.voyager.net [169.207.136.42]) by mailgw01.execpc.com (8.9.1) id QAA29421; Sun, 2 Jul 2000 16:14:10 -0500 Received: from pobox.com (localhost [127.0.0.1]) by woodstock.monkey.net (Postfix) with ESMTP id 38B1216F; Sun, 2 Jul 2000 16:13:44 -0500 (CDT) X-Mailer: exmh version 2.1.1 10/16/1999 To: R Joseph Wright Cc: freebsd-questions@FreeBSD.org Subject: Re: making shell script run in its own directory In-reply-to: Your message of "Sun, 02 Jul 2000 13:09:01 PDT." <20000702130901.A66305@manatee.mammalia.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 02 Jul 2000 16:13:44 -0500 From: Jon Hamilton Message-Id: <20000702211344.38B1216F@woodstock.monkey.net> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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