On 3/2/19 11:47 PM, L A Walsh wrote:

>>  You can get the file
>> and line number where the function is defined when extdebug is on, even if
>> you turn it on after the session has begun, and go from there.
>>   
> ----
>     Unfortunately, I can confirm that this DOES NOT WORK.

Sure it does.

> 
>     Earlier you said you could get the sourcefile + line number from
> BASH_SOURCE and BASH_LINENO(+LINENO).  I demonstrated that they printed
> out completely unrelated values.

No. I said they existed as an example of "behaviors available independent
of invoking the debugger." But that doesn't matter to this example.


> 
> Just now, I tried turning on extdebug and using declare -F to print
> the name of the source file and the line number:
> 
> This is the 1st few lines of a script that shows the problem:
> #!/bin/bash -u
> # vim=:SetNumberAndWidth
> #set -x
> hb=~law/bin (line#4)

I'm going to assume you added the parenthesized comment for this message.

> hl=~law/bin/lib
> 
> if ! [[ $hb =~ $PATH ]]; then export PATH="$hb:$hl:$PATH"; fi
> 
> trap $((1)) DEBUG   (line#0)
> shopt -s extdebug
> declare -F include
> include stdalias

Since you don't provide a definition for `include', it's hard to see
whether or not there's a problem and what it might be.

If you can provide a self-contained example that shows a probem, I'll
look at it.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to