Description : The goals of ShellCheck are:
: * To point out and clarify typical beginner’s syntax issues,
: that causes a shell to give cryptic error messages.
: * To point out and clarify typical intermediate level semantic
: problems, that causes a shell to behave strangely and
: * To point out subtle caveats, corner cases and pitfalls, that may
: cause an advanced user’s otherwise working script to fail under
: future circumstances.
dnf install ShellCheck
And just run the tool on the script to get the common errors.
Whenever I am writing a script in perl or bash, I always wish that there
was some way to have all the commands logged or output to screen. I know
there is “set -x” option to have debugging enabled, but sometimes that
seems to be too much information and I dont really need all that. So, here
is something I found recently for bash to log all the executed commands.
trap "echo $BASH_COMMAND" DEBUG
This will echo/print all the commands on the stdout.