Public bug reported:

Binary package hint: bash

The bash manual should be updated with something like the following.
For more details see

  https://bugs.launchpad.net/ubuntu/+source/bash/+bug/318678


`BASH_SOURCE'

     An array variable whose members are the source filenames where
     the corresponding elements in the `FUNCNAME' array variable are
     defined.  For instance the function `${FUNCNAME[$i]}' is defined
     in the file `${BASH_SOURCE[$i]}' (and was called from file
     `${BASH_SOURCE[$i+1]}'.  See `FUNCNAME'.

`BASH_LINENO'

     An array variable whose members are the line numbers in source
     files where the corresponding members of FUNCNAME were called.
     For instance the function `${FUNCNAME[$i]}' was called at line
     number `${BASH_LINENO[$i]}' (in the file `${BASH_SOURCE[$i+1]}').
     Use `LINENO' to obtain the current line number.  See `FUNCNAME'.

`FUNCNAME'

     An array variable containing the names of all shell functions
     currently in the execution call stack.  The element with index 0
     is the name of any currently-executing shell function.  The
     bottom-most element is `"main"'.  This variable exists only when a
     shell function is executing.  Assignments to `FUNCNAME' have no
     effect and return an error status.  If `FUNCNAME' is unset, it
     loses its special properties, even if it is subsequently reset.

     This variable is most useful together with `BASH_SOURCE' and
     `BASH_LINENO'.  For instance `${FUNCNAME[0]}' is the name of the
     currently running function, it was called in file
     `${BASH_SOURCE[1]}' at line number `${BASH_LINENO[0]}'.  To print
     a back trace of the call stack to stderr use the following
     function

     BT () {
     i=1  # leave out BT from the call stack; set to 0 to include BT
     until test "${FUNCNAME[$i]}" = "main" -o "${FUNCNAME[$i]}"
     do 
        echo "${FUNCNAME[$i]} called from 
${BASH_SOURCE[$i+1]}:${BASH_LINENO[$i]}" >&2 
        let i++
     done 
     }

** Affects: bash (Ubuntu)
     Importance: Undecided
         Status: New

-- 
bash documentation about BASH_LINENO and BASH_SOURCE is vague and inconsistent
https://bugs.launchpad.net/bugs/591677
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to