【发布时间】:2021-10-28 15:29:53
【问题描述】:
搜索位于 2 个不同主目录中的 .txt 文件时,根据当前工作目录,仅显示一个。这是为什么呢?
/home/bob/1.txt
/home/alice/dir1/2.txt
pwd /tmp
[root@host tmp]#find /home -name *.txt
/home/bob/1.txt
/home/alice/dir1/2.txt
pwd /home
[root@host bob]#find /home -name *.txt
/home/bob/1.txt
为什么在 bob 目录中搜索只返回一个文件?
【问题讨论】:
-
ShellCheck 检测到这个问题和其他常见问题,并告诉“Quote the parameter to -name 所以 shell 不会解释它。”
标签: linux bash find gnu-findutils