Environment variable set in tcsh script is not available for bash script [duplicate] Environment variable set in tcsh script is not available for bash script [duplicate] unix unix

Environment variable set in tcsh script is not available for bash script [duplicate]


There is no global environment. Each process has its own environment it can freely change. Changes in a process evironment propagate to new child processes, but0 do not affect any other exisring process.

Thus a shell cannot change its own environment by running an external program. A shell can execute a script without creating a new process though. This is called sourcing. So if a script modifies an environment variable, this affects the sourcing shell. However bash cannot source a tcsh script, and vice versa.

So if you have a tcsh script and a bash script, the only way to propagate environment changes from tcsh to bash is to have the tcsh script call the bash script. Not the other way around.