【问题标题】:Shell programming: How to use find in fish?Shell编程:如何在fish中使用find?
【发布时间】:2013-05-06 05:03:40
【问题描述】:

查看下面在fish中执行的命令,然后是bash:

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





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

鱼为什么听不懂echo {} \;

【问题讨论】:

  • {}find 语法,而不是 shell 语法。 fish 对它有什么特别的作用吗?你试过逃避吗?
  • Aarrrgh,我很想知道 wtf.. 谢谢!

标签: linux shell fish


【解决方案1】:

感谢卡尔。

{} 在鱼中有特殊的含义。他们需要转义才能使用find,例如:

find . -exec echo \{\} \;

【讨论】:

  • 你也可以使用 find 。 -exec echo "{}" \;
【解决方案2】:

从以下错误报告中,'{}' 也可以使用,我认为这是一种更简洁的语法。

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

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

【讨论】:

    猜你喜欢
    • 2021-11-17
    • 2018-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-27
    相关资源
    最近更新 更多