*BSD News Article 26684


Return to BSD News archive

Xref: sserve comp.os.386bsd.questions:8363 comp.unix.questions:45069
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!decwrl!nic.hookup.net!news.kei.com!eff!news.umbc.edu!europa.eng.gtefsd.com!howland.reston.ans.net!cs.utexas.edu!geraldo.cc.utexas.edu!sylvester.cc.utexas.edu!not-for-mail
From: vax@sylvester.cc.utexas.edu (Vax)
Newsgroups: comp.os.386bsd.questions,comp.unix.questions
Subject: Getting directory of executable
Date: 28 Jan 1994 18:32:36 -0600
Organization: The University of Texas - Austin
Lines: 10
Message-ID: <2icar4$ov0@sylvester.cc.utexas.edu>
NNTP-Posting-Host: sylvester.cc.utexas.edu

How would a shell script find out which directory it resides in?

$0 returns the command name, as typed from the line, but how would
you (easily) get the home directory of the script?

I wish to run another program from the same directory, even if the user
doesn't have this directory in his or her path.
-- 
Protect our endangered bandwidth - reply by email.  NO BIG SIGS!
VaX#n8 vax@ccwf.cc.utexas.edu - Don't blame me if the finger daemon is down