[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Determining the current path of a sourced script
From: |
Tony |
Subject: |
Re: Determining the current path of a sourced script |
Date: |
16 Mar 2002 13:28:26 -0800 |
chet@nike.ins.cwru.edu (Chet Ramey) wrote in message
news:<020313135330.AA54220.SM@nike.ins.cwru.edu>...
> > 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
> >
>
> Only if you tell it:
>
> if [ -f /devel/bashrc ]; then
> DEVEL_BASHRC=/devel/bashrc
> . ${DEVEL_BASHRC}
> fi
Chet,
I don't get your point. What you specify is equivalent to what I
already have in my .bashrc... 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.
Tony