[英]Using an ad-hoc libc with a tool which is an argument of another tool
我需要使用特定的libc来运行工具(cp)。 问题在于该工具必须用作另一种工具的参数(例如超时),而我不想与此工具一起使用修改后的libc。
我试着做:
timeout 10 LD_LIBRARY_PATH=/path/to/mod/libc/ cp a b
但是我收到了错误:
timeout: failed to run command 'LD_LIBRARY_PATH=/path/to/mod/libc/': No such file or directory
而且,正如我所说,我做不到:
LD_LIBRARY_PATH=/path/to/mod/libc/ timeout 10 cp a b
因为超时将使用修改后的libc。 有什么办法吗?
您可以使用env
实用程序来实现:
timeout 10 /usr/bin/env LD_LIBRARY_PATH=/path/to/mod/libc/ cp a b
Env将设置环境变量,并在该环境中执行其他实用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.