Grep

Grep

Default options using GREP_OPTIONS

GREP_OPTIONS=
for pattern in .cvs .git .hg .svn node_modules; do
    GREP_OPTIONS="$GREP_OPTIONS --exclude-dir=$pattern
done

export GREP_OPTIONS

Default options using alias:

alias grep='grep --exclude-dir=.git'

Then to run grep without default options, use \grep