我正在尝试运行execlp
,find ... -exec ...
并且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);