bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determining the current path of a sourced script


From: Paul Jarc
Subject: Re: Determining the current path of a sourced script
Date: Sat, 16 Mar 2002 18:11:58 -0500
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/20.7 (i386-redhat-linux-gnu)

address@hidden (Tony) wrote:
> address@hidden (Chet Ramey) wrote in message news:<address@hidden>...
>>      if [ -f /devel/bashrc ]; then
>>              DEVEL_BASHRC=/devel/bashrc
>>              . ${DEVEL_BASHRC}
>>      fi
>
> I don't get your point.

He's saying that bash has no built-in functionality to convey this
information, but if the sourcing script knows where the sourced script
is, it can do the job itself.

> unless your point is specifying a variable which is sure to be *at
> least* a relative path to the script.  Well... that's not even sure
> if the DEVEL_BASHRC directory has been put in the proper place
> within the user's PATH or if the user happened to install it in his
> $HOME directory, then DEVEL_BASHRC could possibly simply be defined
> as DEVEL_BASHRC=bashrc and the script would still have no clue where
> itself was.

Then the sourcing script should simply not do that.  With this method,
it's the sourcing script's responsibility to guarantee that the
variable contains a useful value.


paul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]