The documentation should also note that these 3 arrays along with the
builtin 'caller' do not work properly if called from a function exported
from the interactive shell
++file: .bashrc
myGlobal () {
for i in $(seq 0 ${#FUNCNAME[@]}); do
echo "function: ${FUNCNAME[$i]}"
echo "source: ${BASH_SOURCE[$i]}"
echo "lineno: ${BASH_LINENO[$i]}"
done
}
export -f import
++file: ~/delme
f1 () {
myGlobal
}
f2 () {
f1
}
f2
Personally I had an issue getting a call-stack while attempting to
export a function that would dynamically "import" (source) files in
depending on if they were already defined (c-like). The above was the
root cause.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/591677
Title:
bash documentation about BASH_LINENO and BASH_SOURCE is vague and
inconsistent
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/591677/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs