-
-
Notifications
You must be signed in to change notification settings - Fork 268
Closed
Labels
Milestone
Description
Currently when in DEBUGSCRIPTS mode only "set -x" is done.
Personally I prefer "set -vx" when debugging bash scripts because
'-v' prints the script source code lines (in chunks as read by bash) and afterwards '-x' prints the commands and their arguments as they are executed.
For me this makes debugging issuse very much faster because I see first the original source code lines and then what commands and arguments the bash eveluation results which helps me very much to understand what is actually happening.
Hereby I request that in DEBUGSCRIPTS mode "set -vx" is done.
I propose the following in usr/share/rear/lib/framework-functions.sh
(plus some explanatory comments):
function Source() {
...
# in DEBUGSCRIPTS mode print shell input lines as they are read
# and print commands and their arguments as they are executed:
test "$DEBUGSCRIPTS" && set -vx
# the actual work (source the source file):
Debug "Begin sourcing '$source_file'"
. "$source_file"
Debug "End sourcing '$source_file'"
# undo DEBUGSCRIPTS mode settings:
test "$DEBUGSCRIPTS" && set +vx
If you like it, I make a pull request.