请参见以下在 fish 和 bash 中执行的命令:
tmp ) touch file1 file2 file3 file4
tmp ) find . -exec echo {} \;
tmp ) bash
^_^ ~/tmp > find . -exec echo {} \;
.
./file3
./file2
./file1
./file4
为什么鱼不理解 echo {} \;
?
感谢卡尔。
{
和 }
在 fish 中有特殊含义。为了与 find
一起使用,它们需要进行转义,例如:
find . -exec echo \{\} \;
find . -exec echo '{}' \;
。
https://github.com/fish-shell/fish-shell/issues/95
{}
是查找语法,而不是 shell 语法。fish
对它有特殊处理吗?你尝试过转义它吗? - Carl Norum