Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: alt.sources.d Subject: Re: Multiple executables in path (Was: NON-SOURCE POSTINGS CONSIDERED HARMFUL!) Message-ID: <8807@star.cs.vu.nl> Date: 21 Jan 91 23:01:58 GMT References: <1991Jan17.224403.16050@convex.com> <17373:Jan1908:30:3191@kramden.acf.nyu.edu> Sender: news@cs.vu.nl Reply-To: maart@cs.vu.nl (Maarten Litmaath) Organization: VU Dept. of Computer Science, Amsterdam, The Netherlands Lines: 32 In article <17373:Jan1908:30:3191@kramden.acf.nyu.edu>, brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: )Hmmm. I've always been satisfied with the speed of [_Excessively_ long line split.] ) alias which 'echo `echo "$PATH" | tr : '\''\012'\'\ ) ' | sed -e '\''s+$+/\!:1+'\'' -e '\''s:^:/.[.]:'\'\ ) '` | sed '\''s:/../:/:g'\''' This alias doesn't deal with aliases (easily fixed), but most importantly it _fails_. Two examples: % which passwd /bin/passwd /usr/bin/passwd /etc/passwd # How odd: /etc/passwd is executable! % set path=($path .) % cp /bin/true foo % which foo # Silence. Had you read the documentation of `which5', you would have known it's not that trivial to get things right. -- kinnersley@kuhub.cc.ukans.edu (Bill Kinnersley): "Do phonograph turntables turn the other way in Australia?" gjh@krebs.acc.Virginia.EDU (Galen J. Hekhuis) "How do you think satanic messages were discovered on records?"