Article 1166 of comp.unix.user-friendly: Xref: feenix.metronet.com comp.unix.user-friendly:1166 Newsgroups: comp.unix.user-friendly Path: feenix.metronet.com!news.ecn.bgu.edu!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!math.ohio-state.edu!cs.utexas.edu!convex!tchrist From: Tom Christiansen Subject: Re: MANPATH Message-ID: <1993Nov18.140955.8314@convex.com> Originator: tchrist@convex.convex.com Sender: usenet@convex.com (news access account) Nntp-Posting-Host: convex.convex.com Reply-To: tchrist@cs.Colorado.EDU (Tom Christiansen) Organization: University of Colorado, Boulder References: <1993Nov17.151102.23635@convex.com> <931118.041726-0400@mrexx-0.21> Date: Thu, 18 Nov 1993 14:09:55 GMT X-Disclaimer: This message was written by a user at CONVEX Computer Corp. The opinions expressed are those of the user and not necessarily those of CONVEX. Lines: 114 :-> In comp.unix.user-friendly, Ophof@CS.UWindsor.Ca (F. Scott Ophof) writes: :>Use this. :..[Arcane program deleted].. : :Tom, you are joking, right? :-) :I sincerely hope (and mean it in a POSITIVE sense!) that this isn't :the type of reply you'd send someone explicitely stating to be a :casual/novice Unix user. That program contains 9 words which look :like they could be English, but the rest is "gibberish". Are you really that blind? It was called "manpath". It said so in the examples. It said so in the program source. Where else do you expect me to say it? I expected you to install it so that the next time a user asks this, they can type "manpath" and get what they want to know. If that's just too hard, then they don't care about a manpath anyway. If you say "How do I do this?" and you are given a command to do it and still complain, I really don't know how to help you. :As novice/casual user I'd be off my rocker to run it; heck, it might :delete all my files! You either trust that I have given you something reasonable, which I've found that most people do, or have your system manager deal with it, which is really what I was expecting to happen. :Also, since you didn't specify a name for the :program, a casual/novice user would probably file it as "test"... Again, you just missed it. Go read again. I begin to believe that you feign more ignorance than is the case. :I know you mean well and without doubt the program will do something :beneficial (whatever it does), but it isn't English. Sorry. Big deal -- programs aren't supposed to be English. :>Nope. Anyone on UNIX should spend a little time understanding :>pipes and grep. It's well worth their while. : :If they have the requisite mindset, and can learn to understand :those man pages... If you want to do more than simply login and type the command to run one application, then you can learn this stuff. You can't expect people NOT to have to learn ANYTHING. It doesn't require a requisite mindset. It requires a mere modicum of intelligence, one found not just in CS grad students, but in most bright kids and nearly any adult. Some require more training instead of being self-driven, that's all. --tom Why I do this, I don't know, but if you want something to be more understood by someone who doesn't know the language (which was *NOT* a design goal, mind you -- you odn't expect someone who doesn't know Greek to be able to read Greek!!!), then you could use this. It's the same program. #!/usr/bin/perl ######################################################### # manpath -- intuit manpath based on path envariable # # by tchrist@cs.colorado.edu # # NB: verbose ugly version. use the other one instead. # ######################################################### ### put colon-separated $PATH into a list @bin_path = split ( /:/, $ENV{"PATH"} ); ### start empty... @manpath = (); ### traverse list this one at a time foreach $path_component ( @bin_path ) { ### make sure the first char isn't a dot if ( substr( $path_component, 0, 1) ne ".") { ### make a copy $man_component = $path_component; ### change the last part after the slash to "man" $man_component =~ s/[^\/+]*$/man/; ### does such a directory exist? if ( -d $man_component ) { ### but have we already dealt with it? if ( $already_seen{ $man_component } == 0 ) { ### append it to the list @manpath = ( @manpath, $man_component ); ### remember we have seen it already $already_seen{ $man_component } = 1; } } } } ### put a colon between each element $colon_separated_version = join( ":", @manpath); ### now output what he needs to set his envariable to print STDOUT $colon_separated_version; ### don't forget the newline at the end print STDOUT "\n"; -- Tom Christiansen tchrist@cs.colorado.edu "Will Hack Perl for Fine Food and Fun" Boulder Colorado 303-444-3212 .