Path: utzoo!utgpu!cs.utexas.edu!wuarchive!sdd.hp.com!spool2.mu.edu!news.cs.indiana.edu!rutgers!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: alt.sources.d Subject: Re: NON-SOURCE POSTINGS CONSIDERED HARMFUL! Message-ID: <1943:Jan2619:34:3591@kramden.acf.nyu.edu> Date: 26 Jan 91 19:34:35 GMT References: <1991Jan25.090627.14302@convex.com> <24078:Jan2516:52:2591@kramden.acf.nyu.edu> <1991Jan26.091846.25944@convex.com> Organization: IR Lines: 56 Well, ain't this cute. Tom posts 28 lines of Perl to do FOO. I post 7 lines of sh+tools to do essentially the same thing, and I mention that it doesn't do trivial feature BAR. Tom says ``Your script doesn't at all do the same thing''; when pressed, he admits that he's only talking about BAR. Fine, here's a simple sh script to do FOO + BAR (modulo the minor caveats from before). It's essentially the same as the previous script, with a ``which'' loop in the style people seem to like. Sheesh. Face it, Tom, it takes twenty words of sh code (including | tokens) to combine six *appropriate* tools to list repeated names in $PATH. It takes much, much more than that to solve the problem in Perl without outside help. The only rational conclusion is that Perl is the wrong tool for the job. #!/bin/sh dirs=`echo "$PATH" | tr : '\012'` # List all files in path. Look back to front. Sort, removing duplicates. # Remove all ls info except filename, and select executables. Find reps. for i in `ls -ilFL $dirs | rev | sort -u \ | sed -n -e 's/ .*//' -e 's/^\*//p' | uniq -d | rev`; do # Print the repeats, in some stilted format that tchrist@convex.com wants. # Yes, this is unnecessary duplication of a function already available in # other programs, and it reduces the usefulness of this interface. Oh, well. echo -n "$i: " for j in $dirs; do test -f "$j/$i" && echo -n "$j/$i " done echo '' done > You assume you can tell me what I wrote my script to do, and then you go > on to redefine this. For this they invented the word arrogant, and then > tacked ignorant on to the end of it. Oh, fgs. You described your script as doing FOO, and I described mine as doing FOO. At every stage in this discussion I have been very careful to point out whose script does what, to note the differences (like BAR), etc. I never tried to redefine what yours did, but you said that mine didn't ``at all do the same thing'' as yours---an obviously false statement, intended only to put me down because you know you've lost on technical merits. Take a step back, Tom: who's being arrogant here? > The problem was to list the full path names of all names in > collision. I don't see ``full path names'' in the original problem statement. > Nothing less than this solves the problem. Sure, Tom, whatever you say. ---Dan