Skip to content

Commit

Permalink
Add script debugging when -d -d is used (#111)
Browse files Browse the repository at this point in the history
By using source to call nested scripts this
will work also for such bash scripts.

Co-authored-by: Stefan Weil <[email protected]>
  • Loading branch information
zuphilip and stweil committed Jan 2, 2020
1 parent 745e576 commit 70fd5eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion bin/ocr-transform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ show_version () {

#{{{ main ()
main () {
# debug option -d -d to print all commands to the terminal
if (( DEBUG > 1 ));then
set -x
fi

local from="$1" to="$2" infile='-' outfile='-' transformer
shift 2

Expand Down Expand Up @@ -88,7 +93,7 @@ main () {
exec_saxon "${script_args[@]}"
else
script_args=("$infile" "$outfile" "${script_args[@]}")
"$transformer" "${script_args[@]}"
source "$transformer" "${script_args[@]}"
fi
}
#}}}
Expand Down
7 changes: 6 additions & 1 deletion bin/ocr-validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ show_version () {

#{{{ main ()
main () {
# debug option -d -d to print all commands to the terminal
if (( DEBUG > 1 ));then
set -x
fi

local schema="$1" file="$2"
shift 2

Expand All @@ -56,7 +61,7 @@ main () {
if [[ "${OCR_VALIDATORS[$schema]}" = *.xsd ]];then
"exec_xsdv" "$schema" "$file"
else
"${OCR_VALIDATORS[$schema]}" "$file"
source "${OCR_VALIDATORS[$schema]}" "$file"
fi
}
#}}}
Expand Down

0 comments on commit 70fd5eb

Please sign in to comment.