My project uses an internal tool on Linux, that uses a file called .spacerc for configuring some environmental variables.

The strange thing is, whenever I start a (non-login interactive) bash shell - whether via PuTTy, or via executing $SHELL, or via a python script executing pty.spawn($SHELL) - it reads in .spacerc and sets the environmental variables as specified in it. (And yes, $SHELL is /bin/bash.)

It appears that .spacerc is read before .bashrc is executed (at least the one in the local user directory).

I can't find any info on line that indicates why bash would automatically read in an arbitrary file called .spacerc.

Why might this be happening?


  • 1
    Since this happens on non-login interactive shell,s your first step is to examine ~/.bashrc and, if it exists on your sysetm, /etc/bash.bashrc and see what they execute. – John1024 Apr 26 at 20:49
  • Nothing in any *bashrc* anywhere that refers to a .spacerc file, or that spawns any tool that might. – Yaron Shragai Apr 26 at 21:19
  • Also, just edited OP to add that it appears that .spacerc is read before .bashrc is executed. – Yaron Shragai Apr 26 at 21:28
  • Are these unwanted environment variables specific, as per the question, to "non-login interactive) shell shell" or do they occur for all shells? – John1024 Apr 26 at 21:48
  • Unfortunately, I don't have the capability to log into this system in a different way. – Yaron Shragai Apr 26 at 23:06

Mystery solved: The tool owner added a script to /etc/profile.d directory (which is executed on every shell start), that reads in the tool-specific configuration file.

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.