Commit 83c3f211 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Access grep by absolute path

parent 5ae8991b
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -9,9 +9,21 @@

VCS_DIRS='.bzr .cvs .git .hg .svn'

type which >/dev/null 2>&1 || which() (
	IFS=:
	for dir in $PATH; do
		if [ -x "$dir/$1" ]; then
			echo "$dir/$1"
			return 0
		fi
	done
	echo &>2 "$1 not found"
	return 1
)

case "$1" in
	grep|fgrep|egrep) CMD="$1"; shift ;;
	*) CMD=grep ;;
	grep|fgrep|egrep) CMD=`which $1`; shift ;;
	*) CMD=`which grep` ;;
esac

for dir in $VCS_DIRS $GREP_EXCLUDE_DIRS; do