Path: utzoo!utgpu!cs.utexas.edu!convex!news From: tchrist@convex.COM (Tom Christiansen) Newsgroups: alt.sources.d Subject: Re: Multiple executables in path (Was: NON-SOURCE POSTINGS CONSIDERED HARMFUL!) Message-ID: <1991Jan21.082717.22130@convex.com> Date: 21 Jan 91 08:27:17 GMT References: <17373:Jan1908:30:3191@kramden.acf.nyu.edu> <1991Jan19.105624.15369@convex.com> <26327:Jan2023:24:4091@kramden.acf.nyu.edu> Sender: news@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 24 Nntp-Posting-Host: pixel.convex.com Go away, Dan. The quotes you needed for your solution were gross and nigh unto illegible. If you can't follow a simple three-line piece of simple flow-control, I'm sorry for you. The quoting is also obvious -- go read your shell man page about $foo interpolation in double-quoted strings. The parens make sense if you spend 5 seconds looking at them, thinking about lists in csh, function calls (split) and the precedence of assignment statements. Following the principle of least surprise, -x is obviously from /bin/test. My solution really is much faster on my machine, and provably so. Some people want to bend over backwards for slow, convoluted solutions that you have to dick with to get just quite right; others don't. You do what you want, I'll do what I want, and so will everybody else; they'll decide what's better and easier for them. --tom MINE: for $file (@ARGV) { for $dir (split(/:/,$ENV{"PATH"})) { print "$path\n" if -x ($path="$dir/$file"); } } DAN'S: alias which 'echo `echo "$PATH" | tr : '\''\012'\'' | sed -e '\''s+$+/\!:1+'\'' -e '\''s:^:/.[.]:'\''` | sed '\''s:/../:/:g'\''' -- "Hey, did you hear Stallman has replaced /vmunix with /vmunix.el? Now he can finally have the whole O/S built-in to his editor like he always wanted!" --me (Tom Christiansen )