I'm on a shared machine running CentOS 5.10 that I log onto using VNC from Windows 7. Our default and official shell is csh.

Every time I open a new terminal, I have three particular environment variables (related to the modules system) that are mysteriously set somewhere.

I can't find them in .cshrc, nor in .login (which I don't have anyway), nor in /etc/csh.cshrc or /etc/csh.login or anywhere else I can think of.

Is there a way to trace what sources them?

Just to clarify, if I log onto the gateway machine using PuTTY, I don't face that issue.

  • Perhaps from /etc/profile.d/*.csh? These files are usually sourced by /etc/csh.cshrc. And did you check ~/.tcshrc? Most csh shells these days are really tcsh. – Martin Tournoij May 8 '15 at 14:47
  • @Carpetsmoker No, couldn't find them there, they are all called MODULEPATH or something so greping for MODULE didn't yield anything, unfortunately. – Nobilis May 8 '15 at 14:57
  • According to the docs, MODULEPATH can be edited with module use [-a|--append] directory (or is it modulecmd use ...? I can't seem to parse that page). – lcd047 May 8 '15 at 17:32
  • @lcd047 The issue is that those environment variables are set even before my shell sources .cshrc, I print it at the top of the file right before anything else and it's already there. However on PuTTY, that's not the case (it comes up as undefined). What could the terminal be inheriting the environment from? Some kind of parent process? – Nobilis May 9 '15 at 10:50
  • Have you considered asking your sysadmin? – lcd047 May 9 '15 at 10:59

I spoke with my system administrator and he suggested that the terminal session somehow inherits the environment variable from the current login process/session(?) and recommended I completely log out and log back in again (which I desperately wanted to avoid doing as I have a lot of important terminal sessions in various workspaces I didn't want to waste time restoring).

His explanation for why I didn't face that problem with PuTTY was due to PuTTY initiating a new login session.

It fixed my problem but sadly I couldn't get to the root cause of where that environment variable had come from.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.