Making a good Unix glue language

May 25, 2008

The problem with a search for alternatives to the Bourne shell is that the Bourne shell is still one of the best Unix programming languages. Or perhaps it would be clearer to call it a 'Unix glue language', a language for connecting existing programs together.

You might sensibly ask what the problems are with things like Perl and Python as Unix glue languages, and my answer would be that they make it too hard to interact with external programs. This is important, because the way you write small programs fast on Unix is to take advantage of as many existing programs as possible. Perl and Python are great if you want to implement everything yourself, and sometimes this is the right answer, but not so great if you want to hastily bang something together.

There's several things that I think make for good interaction with programs:

  • make it easy to get results from programs in useful forms. The Bourne shell is only close on this, since it doesn't easily let you pick out individual words from multi-word output.

    (This probably implies that the language is nearly typeless, at least for output from programs.)

  • let you run code in the middle of a pipeline of commands. This is the killer feature for fully participating in pipelines, instead of just running them (as Perl and Python do).

    (For bonus points, the code should be able to change the global state of the program instead of just running in a sub-process.)

  • have built-in, easy to use features for modifying output, since a lot of the time programs don't output exactly what you want so you need to transform it a bit (which is what a lot of what sed and awk get used for, usually in hard to follow ways).

(Of course, a good Unix glue language should still have all the attributes of a good programming language, many of which the Bourne shell lacks. You certainly ought to be able to write normal code without using external programs at all.)


Written on 25 May 2008.
« The risks of forcing frequent password changes
Shimming modules for testing (and fun) »

These are my WanderingThoughts
(About the blog)

Full index of entries
Recent comments

This is part of CSpace, and is written by ChrisSiebenmann.
Twitter: @thatcks

* * *

Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web

This is a DWiki.
GettingAround
(Help)

Search:

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sun May 25 23:46:30 2008
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.