【问题标题】:find exec ls : No such file or directoryfind exec ls : 没有这样的文件或目录
【发布时间】:2019-09-06 15:51:42
【问题描述】:

我尝试执行:

find ~/ -name "*foo*" -exec "ls -la {}" \;

它打印出来了:

find: 'ls -la /home/users/MyUser/fooBar': 没有这样的文件或目录

find: 'ls -la /home/users/MyUser/Barfoo': 没有这样的文件或目录

还有ls 的别名为ls --color

这里发生了什么样的诡计?

【问题讨论】:

  • 我不需要这个别名,只是为了准确。您是对的,请添加您的评论作为对此问题的答案,以便我接受。

标签: bash shell find ls


【解决方案1】:

-exec 的参数不应被引用。删除-exec 之后的引号。并且-exec 不会检测别名,因此您需要将--color 选项传递给exec。

【讨论】:

    猜你喜欢
    • 2019-03-04
    • 2018-01-15
    • 2017-02-10
    • 1970-01-01
    • 2013-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多