Chapter 5: Writing pure Bash or ZSH command-line tools

Alfredo Deza

I’ve been horrified before trying to figure out a piece of production code that was mixing shell scripting and Python. Why would one try to do something like this? A step further was when a large (and custom) Python test framework was doing a system call to a shell that then itself executed Python on a remote system. Can you imagine fixing bugs in that codebase? Where do you start? In the remote server running some odd version of Python, or using a previous version of BASH that has a built-in that behaves differently? Or perhaps in Python that can change some subtle things (like dictionary ordering) from one version to the other?

    writes = run(
        args=[
            'sudo', 'mkdir', 

Get Python Command Line Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.