File: apropos

package info (click to toggle)
feta 1.4.15
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 444 kB
  • ctags: 85
  • sloc: perl: 1,200; sh: 192; makefile: 55
file content (28 lines) | stat: -rwxr-xr-x 693 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# Copyright (c)2002 Joe Wreschnig <piman@debian.org>
# Under the terms of the GNU GPL v2.
# A Feta plugin to search Feta's command help

OPTS=`getopt -n configure -o V,q,t,y -- $@`
if [ $? != 0 ] ; then exit 1; fi
eval set -- "$OPTS"
VERBOSE=0

while true ; do
 case "$1" in
  -V) VERBOSE=1; shift;;
  -t|-q|-y) shift;;
  --) shift; break;;
 esac
done

if [ $# -eq 0 ]; then
 echo "E: You must provide at least one search term."
 exit 1
fi

for I in $*; do for J in /usr/share/feta/help/* /usr/local/share/feta/help/*; do
 if grep $I $J > /dev/null 2> /dev/null; then
  /bin/echo -e "$J:  Found '$I'" | sed 's!^.*/!!'
  if [ $VERBOSE -eq 1 ]; then grep $I $J; echo; fi
 fi done done