1# This file is intended to be sourced from one of the bashdb test programs
2
3sourced_fn() {
4    name="fn2"
5    echo "SOURCED FN LINENO $LINENO"
6
7    # Print a stack trace
8    declare -i n
9    n=${#FUNCNAME[@]}
10    for (( i=0 ; (( i < $n )) ; i++ )) ; do 
11        local -i j=i+1
12	[ $j -eq $n ] && j=i  # main()'s file is the same as the first caller
13	echo "FUNCNAME[$i]: ${FUNCNAME[$i]} called from ${BASH_SOURCE[$j]}" \
14	     "at line ${BASH_LINENO[$i]}"
15    done
16}
17
18echo "SOURCED LINENO $LINENO"
19echo "SOURCED BASH_SOURCE[0]" ${BASH_SOURCE[0]}
20sourced_fn
21
22#;;; Local Variables: ***
23#;;; mode:shell-script ***
24#;;; eval: (sh-set-shell "bash") ***
25#;;; End: ***
26
27