3 # Purpose: query a signature file for a specific keyword and display results
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 # Latest change: Sam Nov 11 20:01:35 CET 2006 [mika]
8 ################################################################################
10 TIPSFILE='/usr/share/grml-tips/grml_tips'
12 if ! [ -r "$TIPSFILE" ] ; then
13 echo "Error: $TIPSFILE not found. Exiting." >&2
17 if [ -x /usr/bin/agrep ] ; then
19 agrep -d "^-- $" -i "$1" $TIPSFILE && echo "" || \
20 ( echo "Sorry, could not find a tip for '$1'. :-(" >&2
21 echo 'If you want to submit a tip please mail it to tips@grml.org - thank you!' >&2
24 echo "Usage: $0 <keyword>" >&2 ; exit 1
26 else # workaround solution for systems without agrep :-/
28 TIP=$(awk "BEGIN { RS = \"-- \" } /$1/" "$TIPSFILE")
29 if [ -n "$TIP" ] ; then
32 echo "Sorry, could not find a tip for '$1'. :-(" >&2
33 echo 'If you want to submit a tip please mail it to tips@grml.org - thank you!' >&2
37 echo "Usage: $0 <keyword>" >&2 ; exit 1
41 ## END OF FILE #################################################################