#!/bin/sh # apropos -- find command apropos a given subject, in section 1 of Unix manual # # AUTHOR: Gary T. Leavens [ -n "$echo" ] && set -x USAGE='Usage: '"$0"' [-s section] subject' SECTION='([1Ll])' case "$1" in -s) shift SECTION='('"$1"')' shift ;; -s*) SECTION='('`expr "$1" : '-s\(.*\)'`')' shift ;; -*) echo "$USAGE" >&2 exit 2 ;; esac # no arguments? if test $# -ne 1 then echo "$USAGE" >&2 exit 1 fi man -k $1 2>&- | grep "$SECTION"