Explorar o código

简化文件内容搜索函数

修改了findByContent函数,简化了参数设计。现在该函数只接受一个参数(模式),在当前目录及其子目录下搜索文件内容。
tianyun hai 7 meses
pai
achega
a04b7cbcfe
Modificáronse 1 ficheiros con 2 adicións e 3 borrados
  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" {} +
 }
 
 # 备份