Shell编程:如何在鱼中使用find?

12 linux shell fish

请参阅以fish执行的以下命令,然后执行bash:

tmp ) touch file1 file2 file3 file4
tmp ) find . -exec echo {} \;





tmp ) bash
^_^ ~/tmp > find . -exec echo {} \;
.
./file3
./file2
./file1
./file4
Run Code Online (Sandbox Code Playgroud)

为什么鱼不明白echo {} \;

小智 18

谢谢卡尔.

{并且}对鱼有特殊的意义.他们需要进行转义才能使用find,例如:

find . -exec echo \{\} \;


sim*_*tek 8

从以下错误报告'{}'中也可以使用,在我看来这是一个更整洁的语法.

所以你最终会得到 find . -exec echo '{}' \;

https://github.com/fish-shell/fish-shell/issues/95