Ways to get a scripting language to echo the line being executed before it actually runs it.
(it's rumored that this was the origin of the name of the movie "Tron", but unfortunately, this was not the case)
PS4='line $LINENO: ' ksh -x scriptname
export PS4='$BASH_SOURCE:$LINENO>> ' set -xTo make it selectively activatable, and work across child process boundaries, put this at the top of all your Bash scripts:
if [ "$BASH_TRON" != "" ]; then export PS4="\033[104;30m$BASH_SOURCE:$LINENO>>\033[0m "; set -x; fiThe Bash Debugger project is also available if you need to go further.
and several other ways
Better yet, use GNU Remake.