shellcheck corrections for bash_utils.sh

Issue #1824 closed
Frank Löffler created an issue

shellcheck (http://www.shellcheck.net/about.html; thanks Ian) provides a way to check for some common mistakes. I've run it on bash_utils.sh and corrected what it found. This mostly fixed hypothetical problems with spaces in paths and such (I doubt the rest of the infrastructure would be up for that, but that's no reason not to fix it).

The attached path contains the changes. Thanks for reviewing.

Keyword:

Comments (5)

  1. Ian Hinder
    • changed status to open
    • removed comment

    The changes look fine. I think the quoting for filenames with spaces is probably not the most important thing. Rather, I think it's important to have source files processed and checked for sanity by some tool. With compiled languages, this is the compiler, which not only compiles the code but also checks syntax and emits warnings for suspicious code. With uncompiled languages, this is up to the language runtime, which may do some cursory checks when the source file is first read, but usually will not do a deep analysis, especially in dynamic languages where the meaning of code can be changed at run-time. The code may in fact be correct, but it is impossible to tell except when that code is actually executed. For these cases, something like pychecker or pylint is very useful. I haven't used shellcheck, but I hope that it can be just as useful.

  2. Log in to comment