blob: 7f4e343b35eb92c80b2756122a8b45667ba750b4 [file] [log] [blame]
#!/bin/sh
inflags=yes
flags=""
while [ $# != 0 -a $inflags = yes ]
do
case "$1" in
-*)
flags="$flags $1"
shift
;;
-)
inflags=no
shift
;;
*)
inflags=no
;;
esac
done
case $# in
0)
echo 1>&2 'usage: g [flags] pattern [files]'
exit 1
;;
1)
pattern="$1"
files=`/bin/ls *.[bcChm] *.cc *.py *.tex *.ms *.java 2>/dev/null`
;;
*)
pattern="$1"
shift
files="$@"
esac
exec 9 grep -n $flags -- "$pattern" $files /dev/null