A request to segregate man pages for shell built-ins

Karl Vogel vogelke at pobox.com
Wed Oct 25 21:09:47 UTC 2017


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



More information about the freebsd-questions mailing list