当前位置: 动力学知识库 > 问答 > 编程问答 >

shell - Piping to 'tee' commands will not set environment variables of the script

问题描述:

I have script say script1 as below

setenv env1 /some/path1

source script2.csh | tee.csh

source env2/script3.csh

Script2 is as below

setenv env2 /some/path2/

# do something

Now environment variable(env2) set in script2 is not reflected in script1.

But if I remove pipe and tee command and only source script2 from script1 then script1 is able to access environment variable env2 .

Like something below

setenv env1 /some/path1

source script2.csh

source $env2/script3.csh

Here i need output to be displayed in screen and log file of script2 execution and also require environment variables to be set in terminal . Please help to generate this .

Thanks

分享给朋友:
您可能感兴趣的文章:
随机阅读: