--- a/dcm_qa/batch.sh
+++ b/dcm_qa/batch.sh
@@ -3,6 +3,8 @@
 # Fail if anything not planed to go wrong, goes wrong
 set -eu
 
+PS4="Running: "
+
 # Test if command exists.
 exists() {
     test -x "$(command -v "$1")"
@@ -67,12 +69,9 @@ else
 fi
 
 # Convert images.
-cmd="$exenam $endian -b y -z n -f %p_%s -o $outdir $indir"
-
-echo "Running command:"
-echo $cmd
-
-$cmd
+set -x
+$exenam $endian -b y -z n -f %p_%s -o $outdir $indir
+set +x
 
 
 # Validate JSON.
@@ -88,14 +87,12 @@ exists python &&
 
 #remove macOS hidden files if they exist
 dsstore=${refdir}/.DS_Store
-[ -e $dsstore ] && rm $dsstore
+[ -e $dsstore ] && rm "$dsstore"
 dsstore=${outdir}/.DS_Store
-[ -e $dsstore ] && rm $dsstore
+[ -e "$dsstore" ] && rm "$dsstore"
 
 #check differences
 
-cmd="diff -x '.*' -br $refdir $outdir -I ConversionSoftwareVersion"
-echo "Running command:"
-echo $cmd
-$cmd
-
+set -x
+diff -x '.*' -br "$refdir" "$outdir" -I ConversionSoftwareVersion
+set +x
