SUMMARY: script that determines its own path

2007-12-24 20:44:00

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 at 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

Comments

Got something to say?

You must be logged in to post a comment.