why Unix?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Apr 7 12:18:40 PDT 2009


grauzone wrote:
> Sure, /bin/sh is the least common denominator. But is there a UNIX that 
> can't run python?

Well one good part about these tools is that there's plenty of overlap 
between them. Like stick-shift cars, you can drive at a given speed in 
two gears without ruining the engine.

I use zsh for shell scripting and don't find it half bad for what I ask 
from it. One good thing about shell scripting is that its paradigm is 
nicely constrained: you operate at file level. In a general language you 
open file, process file, close file. In a shell your file is a unit, and 
a program is a unit. Of course you could also do the same in a general 
language with the right libs, but the playfield is too vast; in a Python 
or Perl script you could find pretty much any code. But as soon as I 
open a shell script, I know where to set my level of expectations. 
Here's where I operate at file and program level, and for the actual 
programs I use another language. That nicely modularizes and 
compartmentalizes my work.

Could you have written Steve's script in python? Absolutely. It'd be the 
same way as driving your car one block to buy a bread - possible, not 
entirely unreasonable, just a bit inefficacious.

There's been a number of experiments to replace the shell with scheme, 
perl, or python. I'm not sure how successful they were for particular 
people, but they didn't quite take. My speculation is that general 
languages are "too powerful" for shell scripting.


Andrei



More information about the Digitalmars-d mailing list