Originally posted by Michael Ernest:
... but I mean shell in the generic sense of a program that acts as a command interpreter, scripting language, display generator, text generator, interactive session manager, all that.
I'm using Sun's SA-245 course material, which is just low on 'practical' examples
Ok, Leslie, let's you and I tussle over some things here:
Now that's an intriguing little statement you have there.
It depends on your criteria, of course, but for my money ksh-93 beats Perl for performance, readability, and usability.
That Perl line on the other site you mention: yes, it's clearly powerful. It's also in my view the least scrutable solution.
That brings me to the cliche harangue I give about Perl code: its write-only nature. It seems like you never know what most Perl code does unless you already know what it does.
What I like about many of previous, more pedestrian examples is it takes very little time to see what's going on. That's key to people who are learning to write to an interpreter.
Off-tangent tangent: one thing David Korn stresses about any shell/interpreter program is that it must unfailingly handle strings of arbitrary length. One goal for that: being able to generate text, more specifically code, to some other HLL (or even assembler, if you want to get nutty about it) through it.
I think what I'll start working on, with that in mind, is a simple shell tool that will parse a .java source file and tell you what's in it in plain English. Too tedious a project for these guys, but hopefully it'll give them an idea of the power of such tools.
Go on, Leslie, hit me with your best shot.