2014/04/03

[linux shell script] findgrep

[ "2" != "$#" ] && {
        echo "syntax:"
        echo "  $0 "'"filename" "greptext"'
        echo '          filename: like *.c or *.cpp'
        echo '          greptext: text you want to search.'
        echo "example:"
        echo "  $0 "'"*.c" "TODO:"'
} || {
        echo '[exec] find . -name "'$1'" | xargs grep "'$2'"'
        find . -name "$1" | xargs grep "$2"
}

沒有留言: