No script is too simple
A follow-up recommendation I give (which I suspect might be unpopular with many around here) is to use Python for all but the most trivial one-liner scripts, instead of shell.<p>Since 3.5 added `subprocess.run` (<a href="https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;subprocess.html#subprocess.run" rel="nofollow">https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;subprocess.html#subprocess...</a>) it&#x27;s really easy to write CLI-style scripts in Python.<p>In my experience most engineers don&#x27;t have deep fluency with Unix tools, so as soon as you start doing things like `if` branches in shell, it gets hard for many to follow.<p>The equivalent Python for a script is seldom harder to understand, and as soon as you start doing any nontrivial logic it is (in my experience) always easier to understand.<p>For example:<p><pre><code>    subprocess.run(&quot;exit 1&quot;, shell=True, check=True)
    Traceback (most recent call last):
      ...
    subprocess.CalledProcessError: Command &#x27;exit 1&#x27; returned non-zero exit status 
</code></pre>
Combine this with `docopt` and you can very quickly and easily write helptext&#x2F;arg parsing wrappers for your scripts; e.g.<p><pre><code>    &quot;&quot;&quot;Create a backup from a Google Cloud SQL instance, storing the backup in a 
    Storage bucket.
    
        Usage: db_backup.py INSTANCE
    &quot;&quot;&quot;
    if __name__ == &#x27;__main__&#x27;:
        args = docopt.docopt(__doc__)
        make_backup(instance=args[&#x27;INSTANCE&#x27;])
 </code></pre>
Which to my eyes is much easier to grok than the equivalent bash for providing help text and requiring args.<p>There&#x27;s an argument to be made that &quot;shell is more universal&quot;, but my claim here is that this is actually false, and simple Python is going to be more widely-understood and less error-prone these days.