diff options
author | wosch <wosch@FreeBSD.org> | 1996-07-08 20:03:18 +0000 |
---|---|---|
committer | wosch <wosch@FreeBSD.org> | 1996-07-08 20:03:18 +0000 |
commit | 5bcd6f63c6d112f1023850c7556c52096067863e (patch) | |
tree | f1b8bfab2e35502777866d60fb83564c8180b3a6 /gnu/usr.bin/man/apropos/apropos.sh | |
parent | f94ea926ede24f1013ce045912c8dcf48b769000 (diff) | |
download | FreeBSD-src-5bcd6f63c6d112f1023850c7556c52096067863e.zip FreeBSD-src-5bcd6f63c6d112f1023850c7556c52096067863e.tar.gz |
Exits 0 on success, and 1 if no keyword matched.
Start $PAGER only if we find a manual page.
Diffstat (limited to 'gnu/usr.bin/man/apropos/apropos.sh')
-rw-r--r-- | gnu/usr.bin/man/apropos/apropos.sh | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/gnu/usr.bin/man/apropos/apropos.sh b/gnu/usr.bin/man/apropos/apropos.sh index cb26c20..66763dd 100644 --- a/gnu/usr.bin/man/apropos/apropos.sh +++ b/gnu/usr.bin/man/apropos/apropos.sh @@ -16,7 +16,7 @@ # # rewritten by Wolfram Schneider, Berlin, Feb 1996 # -# $Id: $ +# $Id: apropos.sh,v 1.3 1996/03/10 18:52:09 wosch Exp $ PATH=/bin:/usr/bin:$PATH @@ -72,5 +72,23 @@ do else echo "$manpage: nothing appropriate" fi -done | $PAGER +done | +( # start $PAGER only if we find a manual page + while read line + do + case $line in + *": nothing appropriate") line2="$line2$line\n";; + *) break;; + esac + done + + # nothing found, exit + if test -z "$line" -a ! -z "$line2"; then + case X"$line2" in X);; *) printf "$line2";; esac + exit 1 + else + ( case X"$line2" in X);; *) printf "$line2";; esac + echo $line; cat ) | $PAGER + fi +) |