[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Determining the current path of a sourced script
From: |
Tony |
Subject: |
Determining the current path of a sourced script |
Date: |
12 Mar 2002 15:08:39 -0800 |
I have a bash script that will be sourced rather than run. Is there
anyway for the script to determine its location (pathname)?
Specifically, in my .bashrc I have:
if [ -f /devel/bashrc ]; then
. /devel/bashrc
fi
Is there any way for /devel/bashrc to determine what directory it is
in? The reason is that /devel/bashrc is a delivered file and it might
wind up in any directory (and probably not /devel) and it needs to
know where itself is so it can set environment variables correctly.
Obviously $0 doesn't help, because that contains "bash".
- Determining the current path of a sourced script,
Tony <=