Multiple executables in path (Was: NON-SOURCE POSTINGS CONSIDERED HARMFUL!)

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Tue Jan 22 01:26:51 AEST 1991


In article <1991Jan21.082717.22130 at convex.com> tchrist at convex.COM (Tom Christiansen) writes:
> The quotes you needed for your solution were gross and nigh
> unto illegible.

Illegible? It's not my fault if you haven't written enough shell code to
instantly recognize '\''. Or would you prefer double quoting?

Has it ever occurred to you that if there were a usable Perl shell, then
it would require just as much special quoting as csh aliases do? I could
put the alias into a separate file so that we're on even ground. Still,
if you don't want to figure out the quoting conventions, you can just
feed csh the alias and type ``alias which'' to see the unquoted version:

  echo `echo "$PATH" | tr : '\012' | sed -e 's+$+/!:1+' -e 's:^:/.[.]:'`
    | sed 's:/../:/:g'

C'mon, surely you admit that ``echo path, make colons into newlines, add
argument at end, add /.[.] at beginning, glob, trash /..'' is not only
an exact reading of the command in linear order, but a perfectly
sensible solution. Again, your Perl solution has no obvious linear flow,
and your eyes have to keep jumping around to see where the data goes.

(If you want to put quotes back into an alias, use the ``quote'' and
``makealias'' aliases, which have been running around for quite some
time now. It takes soooo much effort.)

> If you can't follow a simple three-line piece of simple
> flow-control, I'm sorry for you.

It's just not as instantly obvious as the pipeline. I prefer easily
maintainable code with obvious data flaw (and obvious firewalls) to an
unportable, unconventional, ungodly muck.

> The quoting is also obvious -- go read
> your shell man page about $foo interpolation in double-quoted strings.

Right, so $path="$dir/$file" means to find the value of path, interpret
that as the name of an environment variable, and set that to $dir/$file.
'Zactly like the shell.

> The parens make sense if you spend 5 seconds looking at them,

Yeah. That's about 5 seconds too much.

> My solution really is much faster on my
> machine, and provably so.

Yes, your Convex probably has perl running all the time, so it doesn't
have to be loaded from disk. The large address space must help too.

> Some people want to bend over backwards for
> slow, convoluted solutions that you have to dick with to get just quite
> right;

Yeah. Like yours.

---Dan



More information about the Alt.sources.d mailing list