Post by Angel TsankovHow can a sourced file determine its location?
This is almost always unnecessary; the reasons why have been
explained in this and other newsgroups time and time again. The
question is usually asked about an executed script rather than a
sourced one, and that is somewhat easier to answer.
If you are using bash, try ${BASH_SOURCE[0]}. If that doesn't
contain the full path, the script is in (or relative to) the
current directory.
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence