浏览代码

简化文件内容搜索函数

修改了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" {} +
 }
 
 # 备份