【问题标题】:find command exec {} matching folder empty - Fish shell查找命令 exec {} 匹配文件夹为空 - 鱼壳
【发布时间】:2017-04-24 04:15:58
【问题描述】:

当运行一个简单的find 并尝试在结果上执行-exec 一些命令时,我得到{} 的空值

例如:

$ find ~/folder-with-files -exec echo {} \;

在包含 3 个文件的文件夹上返回空

$
$
$

我在 MacOS 上使用 Fish shell。

【问题讨论】:

  • 您期待 bash 行为。但请注意,zsh、csh、ksh 和 bash 在大括号扩展方面的行为都不同。请参阅github.com/fish-shell/fish-shell/issues/1109,我们正在讨论我们希望鱼的行为方式,尽管已经达成共识,应该单独留下一个独立的{},ala bash。

标签: shell find exec fish


【解决方案1】:

使用 Fish shell 时,{} 变量必须用引号引起来 "{}"

find ~/folder-with-files -exec echo "{}" \;

bashfish shell 中都正确返回

$ file1.txt
$ file2.txt
$ file3.txt

【讨论】:

    猜你喜欢
    • 2014-04-27
    • 1970-01-01
    • 1970-01-01
    • 2019-06-15
    • 1970-01-01
    • 1970-01-01
    • 2019-07-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多