#!/bin/bash
[ "$1" == "" ] && exec echo "Usage: $0 <SEARCH STRING> <MACHINE>"

SEARCHSTR=$1
MACHINE=$2

if [ ! -z "$2" ]; then
  if [ "$MACHINE" == "LOCAL" -o "$MACHINE" == "local" ]; then
    cat ~/.gamerc | egrep -i $1
  else
    sendscript $MACHINE <<< "cat ~/.gamerc | egrep -i $1"
  fi
else
  sendscript allall <<< "cat ~/.gamerc | egrep -i $1"
fi
