[英]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.