Update from my personal hell
John Chambers
jc at trillian.mit.edu
Thu Nov 13 20:48:50 EST 2003
Jerry Feldman writes:
| I stole John's xrand over 10 years ago and modified it for my use. I
| don't use it for Linux, but I did for commercial Unix.
Thief! ;-)
Actually, I've gotten a number of fun messages from people
who found that xrand script on my web site. They're usually
along the lines of "Doing that in a sh script is twisted
and demented; I love it!"
I also used it once in an interview, to establish my shell
scripting creds. I was disappointed that the guy I was
talking to seemed to be favorably impressed by it.
I've also used it as an argument for languages like perl,
tcl or python. Starting up a subprocess to perform a simple
integer calculation does appear to be the easiest way to do
it in a sh script. This script really does fire up five
subprocesses to read a file and select a random line based
on the clock and process id. This is arguably even worse
than the Intercal code to do the same task. The sh code is
probably marginally simpler than the Intercal code, but the
sh code's performance sucks so badly that it's no contest.
It's only saving grace is that it's doing something that
you usually don't want to do very often.
Thus its value as an example. "The Bourne shell wasn't
designed to do this sort of things, so criticising it is
irrelevant. You should use a language that *was* designed
for such things. Then if the code is irreducibly bad, you
have a valid complaint. But there are several scripting
languages in which this would be fast and readable."
OTOH, it's fun to push a tool way past the logical limits
of what it was designed for.
--
O
<:#/> John Chambers
+ <jc at trillian.mit.edu>
/ \ <jmchambers at rcn.com>
More information about the Discuss
mailing list