* Updated grml-tips.
[grml-tips.git] / grml-tips
1 #!/bin/sh
2 # Filename:      grml-tips
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: Mit Nov 01 12:02:06 CET 2006 [mika]
8 ################################################################################
9
10 TIPSFILE='/usr/share/grml-tips/grml_tips'
11
12 # another approach:
13 # awk 'BEGIN { RS = "-- " } /$1/' $TIPSFILE
14
15 if [ -r "$TIPSFILE" ] ; then
16   if [ -n "$1" ] ; then
17     agrep -d "^-- $" -i "$1" $TIPSFILE && echo "" || \
18     ( echo "Sorry, could not find a tip for '$1'"
19       echo 'If you want to submit a tip please send it to tips@grml.org - thank you!' )
20   else
21     echo "Usage: $0 <keyword>" ; exit 1
22   fi
23 else
24   echo "Error: $TIPSFILE not found. Exiting."
25   exit 1
26 fi
27
28 ## END OF FILE #################################################################