소스 검색

简化文件内容搜索函数

修改了findByContent函数,简化了参数设计。现在该函数只接受一个参数(模式),在当前目录及其子目录下搜索文件内容。
tianyun 7 달 전
부모
커밋
a04b7cbcfe
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      sh_config.sh

+ 2 - 3
sh_config.sh

@@ -236,9 +236,8 @@ function findByName() {
 	find . -name "*$pattern*"
 }
 function findByContent() {
-	local pattern=$2
-	local dir=$1
-	find $dir -type f -exec grep -l "$pattern" {} +
+	local pattern=$1
+	find . -type f -exec grep -l "$pattern" {} +
 }
 
 # 备份