[X-Unix] Re: Shell Script: How get parent path to invoke a sister tool?

Peter Dyballa Peter_Dyballa at Web.DE
Fri May 23 12:30:15 PDT 2008

Am 23.05.2008 um 16:28 schrieb Jerry Krinock:

> I want to ship someone a directory containing two files: a shell
> script and a tool.  Within the shell script, I'd like to invoke the
> tool.  And I want it idiot-proofed to work regardless of where the
> user drops my directory.

`dirname $0` or $(dirname $0) should return the path to the script,  
i.e., the name of the directory containing both the script and the tool.

Don't forget to think of spaces in the path!



’Twas a woman who drove me to drink, and I never had the courtesy to  
thank her for it.
				— W.C. Fields

More information about the X-Unix mailing list