Bash Pitfalls
I consider shellcheck absolutely essential if you&#x27;re writing even a single line of Bash.  I also start all my scripts with this &quot;unofficial bash strict mode&quot; and DIR= shortcut:<p><pre><code>    #!&#x2F;usr&#x2F;bin&#x2F;env bash
    
    ### Bash Environment Setup
    # http:&#x2F;&#x2F;redsymbol.net&#x2F;articles&#x2F;unofficial-bash-strict-mode&#x2F;
    # https:&#x2F;&#x2F;www.gnu.org&#x2F;software&#x2F;bash&#x2F;manual&#x2F;html_node&#x2F;The-Set-Builtin.html
    # set -o xtrace
    set -o errexit
    set -o errtrace
    set -o nounset
    set -o pipefail
    IFS=$&#x27;\n&#x27;

    DIR=&quot;$( cd &quot;$( dirname &quot;${BASH_SOURCE[0]}&quot; )&quot; &amp;&amp; pwd )&quot;
</code></pre>
I have more tips&#x2F;tricks here: <a href="https:&#x2F;&#x2F;github.com&#x2F;pirate&#x2F;bash-utils&#x2F;blob&#x2F;master&#x2F;util&#x2F;base.sh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pirate&#x2F;bash-utils&#x2F;blob&#x2F;master&#x2F;util&#x2F;base.s...</a>