1

我在 cgywin 上的“find”命令有问题。我在这里找到了一个使用此命令的测试文件:

$ find . 'test'
.
./asdftest
./asdftext.txt
./test
./test/asdfastest.txt
./test/test.txt
./test.txt
./textasfa.txt
test
test/asdfastest.txt
test/test.txt

我完全困惑为什么当我这样做

find . -regex 'test'

结果我什么也得不到。我尝试了很多组合,但从来没有任何运气。这是怎么回事?提前致谢。

4

1 回答 1

1

您需要使用-name选项:

 find . -name '*test*'

使用该-regex选项,以下将起作用,因为每个文件名都以 开头./

find . -regex './.*test.*'

或者更准确:

find . -regex '^\./.*test.*'
于 2013-11-04T09:47:33.590 回答