A Unix without a test program

September 16, 2008

Courtesy of a recent entry, I was reading over my dotfiles when I stumbled over a remnant of a rather peculiar and annoying Unix (unfortunately, I no longer remember which one it was). This Unix was notable for a simple reason: it didn't have a test program.

You might sensibly ask how on earth anything that can possibly call itself a Unix would be missing such a basic thing; after all, without test a lot of scripts don't work at all, since test is also known as '[', which is commonly used in Bourne shell condition checking. The answer is simple: the people behind this Unix had made test a shell builtin, so all of the shell scripts still worked. They just hadn't set up a /bin/test program, presumably because they didn't expect any sensible program to run test directly.

(This is slightly less crazy than it seems; if you have a a test program and also a test shell builtin, you have to make sure that the two behave exactly the same. If you expect the test program to never be used, removing it simplifies your life and means that you don't have to keep it in sync with your improvements to the shell builtin.)

As it happens, there is one sort of sensible program that does exactly this: non-standard shells. My shell doesn't have test as a builtin, so I needed an actual test program; when this Unix didn't have one, my dotfiles became moderately unhappy.

(My solution was to make a test Bourne shell script that just ran the shell's builtin test, which is what this particular Unix vendor should have done for /bin/test in the first place.)

Written on 16 September 2008.
« Why ZFS's raidz design decision is sensible (or at least rational)
How to securely manipulate user files »

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

Last modified: Tue Sep 16 01:04:04 2008
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.