Path: utzoo!utgpu!cs.utexas.edu!yale!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: <18354:Jan2415:53:5391@kramden.acf.nyu.edu> Date: 24 Jan 91 15:53:53 GMT References: <1991Jan17.224403.16050@convex.com> Organization: IR Lines: 33 In article <1991Jan17.224403.16050@convex.com> tchrist@convex.COM (Tom Christiansen) writes: > And just so I am not zapped for not practicing what I preach, here's > a little script that points out executables in your path whose names > occur more than once, you know, like /bin/mail and /usr/ucb/mail. [ 36-line perl script, including 28 lines of real code ] Here's a little script that points out executables in your path whose names occur more than once, you know, like /bin/mail and /usr/ucb/mail. (N.B. This isn't meant as a clone of Tom's script; it doesn't bother printing where the conflicts are, for example.) Just so Tom doesn't accuse me of cheating, I spread everything out onto separate lines, so this is an 11-line script, including 7 lines of real code. Now what is easier to maintain: a simple 7-line shell script, or a 28-line perl script? Moral: Use the right tools for the right job. (And don't pretend that adding a trivial script to an alt.sources.d posting makes it appropriate for alt.sources.) #!/bin/sh # omit L if no symbolic links # replace sort -u with sort | uniq if sort doesn't support -u ls -ilFL `echo "$PATH" | tr : '\012'` \ | sed -n 's/\*$//p' \ | rev \ | sort -u \ | sed 's/ .*//' \ | uniq -d \ | rev ---Dan