ShellCheck – check basic POSIX shell script errors

Here is description of the tool:

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
:   counter-intuitively.
: * To point out subtle caveats, corner cases and pitfalls, that may
:   cause an advanced user’s otherwise working script to fail under
:   future circumstances.

To install

dnf install ShellCheck

And just run the tool on the script to get the common errors.

bash debug – log all executed commands

Screenshot of a Bash 3.1 session demonstrating...
Screenshot of a Bash 3.1 session demonstrating its particularities. Shows exporting a variable, alias, type, Bash’s kill, environment variables PS1, BASH_VERSION and SHELLOPTS, redirecting standard output and standard error and history expansion. A POSIX session is launched from a normal session. Finally, the POSIX session kills itself (since just “exit” would be too boring). (Photo credit: Wikipedia)

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.


This will echo/print all the commands on the stdout.


Enhanced by Zemanta