Obnoxious postings from Google Groups

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Nov 7 00:14:40 CET 2012

On Tue, 06 Nov 2012 11:51:03 -0500, GangGreene wrote:

> I have just finished a 251 line bash shell script that builds my linux
> distro from scratch.

"From scratch"? So if you run it on bare metal with no OS, it works?


But seriously -- bash is a mature, powerful shell. It works well for what 
it does. It has been designed to make it easy[1] to automate system admin 
tasks. It would be astonishing if an experienced, competent bash 
programmer couldn't write an installation tool in bash. By comparison, 
few general purpose programming languages (with the obvious exception of 
perl) are designed for system administration as their primary purpose.

But... how robust is your script? How many bugs does it contain? Chances 
are you will only use it a handful of times, on the same system. That's 
not a lot of testing to be sure that it is free of bugs, and robust 
against unexpected input.

Hell, even widely used and distributed install scripts written by 
companies with the resources of Ubuntu and Red Hat have a distressing 
tendency to break. Or worse, to behave in unexpected ways.

Unless you are some sort of bash-scripting über-geek superhero with 
powers beyond those of mortal men, chances are that your script is much 
more buggy and fragile than you imagine. How well does it recover from 
errors? Does it leave you with a broken system, half installed? How 
easily can you maintain it after three months? Will it work in the 
presence of filenames with newlines in them?

[1] For some definition of "easy". In my opinion, control structures like 
"for" and "if" in bash are hard to use, hard to read, easy to get wrong, 
give cryptic error messages when you do get them wrong, and are ugly. 
Tests are obfuscated, and as always, the fact that everything is text in 
bash means it is way harder than it needs to be to use rich, modern data 


More information about the Python-list mailing list