Refer: https://tecadmin.net/tutorial/bash-scripting/bash-debugging/
Example – Enable Debug in Script
You can enable debug mode by adding set -xv option inside a shell script. This is useful to enable debugging for some part of the script.
#!/bin/bash
set -xv # this line will enable debug
cd /var/log/
for i in "*.log"; do
du -sh $i
done
