An error occurred while fetching participants.
unset csh environment variables when sourcing cshrc twice
Summary
In a c-shell if sourcing ~OpenFOAM/OpenFOAM-v2112/etc/cshrc
MORE THAN ONCE, the OpenFOAM paths are missing from the environment variable $PATH
and so OpenFOAM code will no longer operate.
Steps to reproduce
> source ~OpenFOAM/OpenFOAM-v2112/etc/cshrc
> echo $PATH
> source ~OpenFOAM/OpenFOAM-v2112/etc/cshrc
> echo $PATH
Example case
What is the current bug behaviour?
OpenFOAM paths are missing from $PATH
What is the expected correct behavior?
OpenFOAM paths are in $PATH
Relevant logs and/or images
Environment information
- OpenFOAM version :v2112 (and possibly earlier)
- Operating system : centos or any (presumably)
- Hardware info :
- Compiler :gcc or any (presumably)
Possible fixes
In etc/config.csh/setup
there are two occurrences of the following three lines:
_foamClean PATH "$foamOldDirs"
_foamClean MANPATH "$foamOldDirs"
_foamClean -lib "$foamOldDirs"
If you replace the second occurrence by
_foamClean PATH
_foamClean MANPATH
_foamClean -lib
This fixes the issue.