Shell编程:如何在fish中使用find命令?

13

请参见以下在 fish 和 bash 中执行的命令:

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





tmp ) bash
^_^ ~/tmp > find . -exec echo {} \;
.
./file3
./file2
./file1
./file4

为什么鱼不理解 echo {} \;


5
{} 是查找语法,而不是 shell 语法。fish 对它有特殊处理吗?你尝试过转义它吗? - Carl Norum
啊啊啊,我在想什么鬼。。谢谢! - Nils
2个回答

19

感谢卡尔。

{} 在 fish 中有特殊含义。为了与 find 一起使用,它们需要进行转义,例如:

find . -exec echo \{\} \;


你也可以使用 find . -exec echo "{}" ; - Harald

9

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接