On 9/2/14, 2:59 PM, jim.av...@gmail.com wrote: > Bash Version: 4.3 > Patch Level: 0 > Release Status: release > > Description: > > The "source" (or ".") command, if invoked from within a function, > creates a call frame, setting $FUNCNAME[0] to "source" and > $BASH_SOURCE[1] and $BASH_LINENO[1] to the location of the "source" > statement. > > However this does not occur if the "source" statement occurs in > mainline code, i.e. outside of any function.
This is true. The FUNCNAME variable is not visible outside functions, so the assignment of `source' to FUNCNAME, which was done primarily for the bash debugger's convenience, doesn't have any effect when outside a function. > > This means that code in "sourced" files can not reliably > display the location of their call, i.e., the location of > the "source" (or ".") statement which invoked them. But this is not. If you want to see where the sourced file was invoked, use ${BASH_SOURCE[1]}:${BASH_LINENO} or the `caller' builtin. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/