Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!samsung!uunet!mcsun!hp4nl!charon!dik From: dik@cwi.nl (Dik T. Winter) Newsgroups: alt.sources.d Subject: Re: NON-SOURCE POSTINGS CONSIDERED HARMFUL! Message-ID: <2856@charon.cwi.nl> Date: 27 Jan 91 02:27:34 GMT References: <24078:Jan2516:52:2591@kramden.acf.nyu.edu> <1991Jan26.091846.25944@convex.com> <1943:Jan2619:34:3591@kramden.acf.nyu.edu> Sender: news@cwi.nl Organization: CWI, Amsterdam Lines: 49 Now I thought that the discussion was about a script/program that acted which- like and pointed to duplicates. Dan moves on to another field giving a script that gives all duplicate executables in your path; it does not look at the arguments you give. I have a few complaints (and than thinking that Dan complained that the perl script was not portable!). A number of these already apply to Dan's one- liners (did you program APL originally?). In article <1943:Jan2619:34:3591@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: ... > for i in `ls -ilFL $dirs | Complaint 1: ls complains about non existing directories that I have in my path. I know I have them, my base path is identical on all machines I have access to. So this should be changed to: for i in `(ls -ilFL $dirs 2>/dev/null) | (And as noted already the -L flag is illegal on some (UNIX) systems.) > rev | Complaint 2: some of the (UNIX) systems I have access to tell me: rev not found. What do I do now? Write a csh alias to do rev? > sort -u \ Looks correct. > | sed -n -e 's/ .*//' -e 's/^\*//p' | Complaint 3: Mmm. What with a filename that ends in an asterisk? And files with embedded blanks? (And do not come with the answer that people should not have files with such names, because people do have them. Just like they have '.' in their path. Be robust, just as in another thread: There should be no limits.) > uniq -d | rev`; do Looks correct (except for rev of course). > echo -n "$i: " Complaint 4: On some (UNIX) systems this will not echo what you want. But than you have already a problem with rev of course. > for j in $dirs; do Correct again. > test -f "$j/$i" && echo -n "$j/$i " Same complaint about echo. > done Correct. > echo '' Why those quotes? > done Correct again. Score: 8 lines of code, 3 correct. Dan, Dan, you ought to do better. -- dik t. winter, cwi, amsterdam, nederland dik@cwi.nl