'发现'用通配符

时间:2015-05-12 03:14:39

标签: find osx-yosemite

我在OS / X优胜美地。我已经多次执行类似的搜索:不确定为什么它在这里不起作用。

搜索是:

$find . -name \*assembly\*.jar

它返回 nothing

现在,应该返回什么?好吧,让我们删除扩展名并重新运行搜索:

 $find . -name \*assembly\*

那么它会返回许多项目 - 包括第一项......以 .jar 结尾!

./mllib-tests/target/mllib-perf-tests-assembly.jar
./mllib-tests/target/streams/$global/assembly
./mllib-tests/target/streams/$global/assembly/$global/streams/assembly-inputs
./mllib-tests/target/streams/$global/assembly/$global/streams/assembly-outputs
./mllib-tests/target/streams/$global/assemblyOption
./mllib-tests/target/streams/$global/assemblyOption/$global/streams/assembly
./spark-tests/target/spark-perf-tests-assembly.jar
./spark-tests/target/streams/$global/assembly
./spark-tests/target/streams/$global/assembly/$global/streams/assembly-inputs
./spark-tests/target/streams/$global/assembly/$global/streams/assembly-outputs
./spark-tests/target/streams/$global/assemblyOption
./spark-tests/target/streams/$global/assemblyOption/$global/streams/assembly

那么..为什么第一次搜索失败了?

1 个答案:

答案 0 :(得分:0)

确定发现了答案。

 \* 

通配符 零个或多个字符匹配。它显然是一个或多个字符匹配。

以下 工作

$find . -name \*assembl\*.jar

./mllib-tests/target/mllib-perf-tests-assembly.jar
./spark-tests/target/spark-perf-tests-assembly.jar