把cgrep mgrep集成到bashrc
https://android.googlesource.com/platform/build/+/android-4.4.3_r1/envsetup.sh
在~/.bashrc里面增加
#Android tool function cgrep() { find . -name .repo -prune -o -name .git -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@" } function mgrep() { find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -type f -print0 | xargs -0 grep --color -n "$@" } find . -name .repo -prune -o -name .git -prune -o -type f \( -name '*.prop' -o -name '*.mk' -o -name '*.sh' -o -name '*.js' -o -name '*.json' \) -print0 | xargs -0 grep --color -n "$@"