Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux bash find-exec有时工作,有时不工作';T_Linux_Find_Rsnapshot - Fatal编程技术网

Linux bash find-exec有时工作,有时不工作';T

Linux bash find-exec有时工作,有时不工作';T,linux,find,rsnapshot,Linux,Find,Rsnapshot,我可能遗漏了一些东西,但这是bash脚本中的一行程序,可以循环使用一些从不同来源转储数据的脚本: find . -name 'dump-*.sh' -exec {} "$DUMP_LOG" &>>"$DUMP_LOG" \; 将在我直接执行包含此oneliner的bash脚本时工作,但在rsnapshot中将其作为cmd_preexec调用时不工作。它不会产生任何错误,只是什么都不做 我尝试添加“(/bin/)bash-c”,如下所示: find . -name 'dump

我可能遗漏了一些东西,但这是bash脚本中的一行程序,可以循环使用一些从不同来源转储数据的脚本:

find . -name 'dump-*.sh' -exec {} "$DUMP_LOG" &>>"$DUMP_LOG" \;
将在我直接执行包含此oneliner的bash脚本时工作,但在rsnapshot中将其作为cmd_preexec调用时不工作。它不会产生任何错误,只是什么都不做

我尝试添加“(/bin/)bash-c”,如下所示:

find . -name 'dump-*.sh' -exec bash -c '{} "$DUMP_LOG" &>>"$DUMP_LOG"' \;

但是我得到一个关于“(/bin/)bash不存在的错误,即使我直接打开脚本。

好吧,我真傻。当然,find cmd的第一个参数需要工作目录

find /usr/local/sbin -name 'dump-*.sh' -exec {} "$DUMP_LOG" &>>"$DUMP_LOG" \;
解决了这个问题