Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 bash 中,我可以为一个命令设置一个临时环境变量,如下所示:
LD_LIBRARY_PATH=/foo/bar myprogram
我可以在 csh / tcsh 中做类似的事情吗?我可以做
setenv LD_LIBRARY_PATH /foo/bar; myprogram; unsetenv LD_LIBRARY_PATH
,但这将丢失该变量之前的任何值。
在 csh 中,您可以尝试env:
env
% env LD_LIBRARY_PATH=/foo/bar myprogram
或者,一个子shell:
% (setenv LD_LIBRARY_PATH /foo/bar; myprogram)