【发布时间】:2017-12-10 16:37:39
【问题描述】:
我正在尝试使用find ... -exec ... 运行execlp,而find 程序始终告诉我:
find: missing argument to `-exec'
可能出了什么问题?当我在 shell 上使用这些参数运行 find 时,它会成功。
我的函数调用如下(在查看了相关的 SO 线程后,我尝试了几种参数排列):
execlp("find","find","/home/me","-exec","/usr/bin/stat", "{}", "\\;",NULL);
execlp("find","find","/home/me","-exec","/usr/bin/stat", "'{}'", "\\;",NULL);
execlp("find","find","/home/me","-exec","/usr/bin/stat", "{}", "';'",NULL);
execlp("find","find","/home/me","-exec","/usr/bin/stat {} \\;",NULL);
【问题讨论】:
-
execlp == C ?在linux下?也许添加那些标签。
-
@PatrickArtner:添加