I have 2 small functions to abbreviate set -x
/ set +x
, namely:
sx () {
export PS4='+ [${BASH_SOURCE##*/}:${LINENO}]'
set -x
}
and
sz () {
set +x
export PS4=
}
These 2 functions are in a file functons.sh
which is sourced from ~/.bashrc
, and visible online here.
Immediately after logging in to a new bash session, I try to find out where the sz()
function is like this:
$ shopt -s extdebug; declare -F sz; shopt -u extdebug
sz 25 /Users/jab/src/git/hub/jab/src/bash/keyboard/z.sh
This shows that bash
thinks the sz()
function is declared in z.sh
, but at that line there is a different function, zzz()
, online here.
The result for the sx()
function (and all my myriad other functions) is correct
$ shopt -s extdebug; declare -F sx; shopt -u extdebug
sx 428 /Users/jab/src/git/hub/jab3/src/bash/functons.sh
Why does the declare -F
command get the wrong result for the sz
function?