Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Oct 2017 17:09:21 -0400
From:      "Karl Vogel" <vogelke@pobox.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: A request to segregate man pages for shell built-ins
Message-ID:  <20171025210920.GA22834@bsd118.wpafb.af.mil>
In-Reply-To: <f88cd63e-3cbc-4463-5219-99d204742b85@FreeBSD.org>
References:  <VI1PR02MB1200817E0E2CDD2A2A42E1A5F6440@VI1PR02MB1200.eurprd02.prod.outlook.com> <f88cd63e-3cbc-4463-5219-99d204742b85@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 25, 2017 at 07:14:28AM +0100, Matthew Seaman wrote:

> I'm sure creating separate man pages is possible: it's just a question
> of someone stepping up and doing the work.

  Here's a "solution" from the baling-twine-and-ductape school of coding.
  I ran "compgen -b" under bash and got a list of builtins:

    .
    :
    [
    alias
    [...]
    unalias
    unset
    wait

  A little vi:

    help . >  dot.1
    help : > :.1
    help [ > [.1
    help alias > alias.1
    help unalias > unalias.1
    help unset > unset.1
    help wait > wait.1

  Run "strings" on /path/to/man and find the default MANSECT.  Stick all
  these files under /usr/local/man/cat1b and give it a test-drive:

    #!/bin/ksh
    #<myman: quick manpage test
    export PATH=/usr/local/bin:/bin:/usr/bin
    export MANSECT=1b:1:1p:8:2:3:3p:4:5:6:7:9:0p:tcl:n:l:p:o

    case "$1" in
        .) page=dot ;;
        *) page=$1 ;;
    esac

    man $page
    exit 0

  You could do something just as hideous for ksh/tcsh/whatever and put
  the results under separate sections.  In one of your login dotfiles:

    export MANSECT=1:1p:8:2:3:3p:4:5:6:7:9:0p:tcl:n:l:p:o

    case "$SHELL" in
        *bash)  add="1b" ;;
        *csh)   add="1c" ;;
        *zsh)   add="1z" ;;
    esac

    MANSECT="${add}:$MANSECT"

... I'll show myself out.

-- 
Karl Vogel                      I don't speak for the USAF or my company

You're the type of guy who'd give a Rubik's Cube to Forrest Gump.
                                                     --Local DJ, station Z93




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171025210920.GA22834>