delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/07/20/05:36:19

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <01C110C5.EEE26260.jorgens@coho.net>
From: Steve Jorgensen <jorgens AT coho DOT net>
Reply-To: "jorgens AT coho DOT net" <jorgens AT coho DOT net>
To: "cygwin AT cygwin. Com (E-mail)" <cygwin AT cygwin DOT com>
Subject: Handy script offering
Date: Fri, 20 Jul 2001 02:44:32 -0700
X-Mailer: Microsoft Internet E-mail/MAPI - 8.0.0.4211
MIME-Version: 1.0

Ok, perhaps no one cares, but as one of the many 'nix newbies who start 
playing with Cygwin, I scratched an itch that other newbies might have.

The problem is that when you type man <command>, but you enter the common 
command name that all the books tell you about rather than the name of the 
program that's a symlink to on Cygwin, there appears to be no manpage. 
 This one bit me, and I thought there was no man page for "awk" not 
realizing I should be asking for "man gawk".

I wrote a perl script that solves the problem which is included below.  It 
would be very handy for other newbies to have this in the distribution and 
mention it in the manual.

#!/bin/perl

if ( scalar @ARGV ne 1 ) {
    print "\nUsage: metaman <command_name>\n\n";
    print "this command displays the man page for the named program.\n";
    print "If the name refers to a symbolic link to another program,\n";
    print "the man page for that program is displayed.\n";
} else {
    $found = `find \`which $ARGV[0] 2> /dev/null\` -printf \"%l\"`;
    if ( $found =~ /([^\/]+)$/ ) {
        $found = $1;
        $found =~ s/.exe//;
        system("man $found");
    } else {
        system("man $ARGV[0]");
    }
}


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019