Sample Header Ad - 728x90

Setting environment variable using shell script

2 votes
1 answer
2037 views
I am using csh scripts for some automation purpose. I have a number of scripts, and the beginning of all of which I need to set a fixed set of environment variables. |----SCRIPT 1---| |----SCRIPT 2---| |# set env vars | |# set env vars | | | | | |# do something | |# do something | | | |# else | So I thought that I'll put all the environment variables in another script and source it from each file. But as it turns out, environment variables set inside the sourced script are not reflected outside. Is there any clean way to achieve what I want? Or do I have to explicitly set environment variables in each script ? **UPDATE :** While sourcing the file, I was piping the output to a file using the 'tee' command. I noticed that after removing the pipe, the script file worked.
Asked by johngreen (131 rep)
Jan 19, 2016, 05:56 AM
Last activity: Jun 21, 2024, 01:05 PM