#!/bin/sh
#
# $Id: phone,v 1.11 2006/10/03 17:49:36 davido Exp $
#
# NOTE: The original of this file is under RCS control
#
#       Update $Source: /FC2/RSYNC/work/sysadmin/local/bin_scripts/RCS/phone,v $
#       and copy to /usr/local/bin_scripts.
#
# Search the teledex file for entries matching the words specified
#
PATH=/usr/bin:$PATH
if [ "$1" = "" ]; then
   echo "Teledex search string: \c"
   read str
   str=`echo $str | sed 's/
$//'`
   exec $0 $str
fi
if [ "$1" = PASSTHRU ]; then
   grep -i "$2"|
   (if [ -n "$3" ]; then
      shift
      shift
      $0 PASSTHRU "$@"
    else
      cat
    fi)
else
   (grep -i "$1" $HOME/.teledex 2>/dev/null
    grep -i "$1" /work/sysadmin/teledex) |
   (if [ -n "$2" ]; then
      shift
      $0 PASSTHRU "$@"
    else
      cat
    fi)
fi
