#!/bin/bash
find . -iname \*.[ch] -exec grep --color -wn -H $1 \{\} \;
find . -iname \*.cpp -exec grep --color -wn -H $1 \{\} \;
总结一下语法就是:
find $搜索目录 -iname \*.cpp -exec grep --color -wn -H $1 \{\} \;
#!/bin/bash
find . -iname \*.[ch] -exec grep --color -wn -H $1 \{\} \;
find . -iname \*.cpp -exec grep --color -wn -H $1 \{\} \;
总结一下语法就是:
find $搜索目录 -iname \*.cpp -exec grep --color -wn -H $1 \{\} \;