How To Debug a Bash Shell Script Under Linux or UNIX

Originally published at: https://www.cyberciti.biz/tips/debugging-shell-script.html

From my mailbag:
    I wrote a small hello world script. How can I Debug a bash shell scripts running on a Linux or Unix like systems?
It is the most common question asked by new sysadmins or Linux/UNIX user. Shell scripting debugging can be a tedious job (read as not easy). There are various ways to debug a shell script.