Suppose your need one method to debug the issue, right? Please add "set -x" in the script to debug the issue. man bash: set -x: After expanding each simple command, for command, case command, select command, or arithmetic for command, display the expanded value of PS4, followed by the command and its expanded arguments or associated word list.