From Secure Computing Wiki
Revision as of 08:39, 23 May 2008 by (Talk) (get name of host directory for a script)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

To get the name of the directory in which a script resides, the following code example will work:

echo "I live in `dirname $0`"

Simply put this in within your home directory, and do the following to see:

cd /
sh ~/