SUMMARY: script that determines its own path

From: Thomas Rose <sunman_at_gmxpro.de>
Date: Thu Sep 06 2001 - 04:57:44 EDT
Hello list,

original question:

> imagine a ksh-script /mypath/myksh.
> 
> I want that script to print out its own location, i.e. /mypath.
> [...]

The most simple way to do this is:

# cat /bin/heckmeck
#!/bin/ksh

dir=$(dirname $0)
( cd $dir; pwd )


Thanks to everybody who replied (far too much to mention),
Thomas 

-- 
perl -e 'print pack("c*",hex "3A",sqrt(2025),(unpack(c,"=")-20),10);'


The information contained in this email is intended only
for the use of the named addressee. If the reader of this
message is not the named addressee, you are hereby notified
that you must immediately destroy this message and inform 
swatteam@wecouldtellyoubutwewouldhavetokillyou.com.
Someone will visit you shortly and remove all traces of
the email from your memory. You will also be sterilized to
be certain that you do not reproduce a memory of this email.

http://www.wizards-of-os.de
Received on Thu Sep 6 09:57:44 2001

This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:32:30 EDT