Question

I'm attempting to discover how some virtualenvwrapper function definitions are getting into my shell. (More specifically, because they're the old version, and I want to get rid of them, put in a new version.)

I've grepped for sourcing stuff in my ~/.bashrc, I've even checked that going

env -i HOME=/tmp bash

does not have the definitions, which is true, so I'm pretty sure it's not the system bashrc.

So, bash when setting up the shell sources a number of files like:

source .bashrc

and

source .bash_aliases

And so on. But is there anyway to have bash print the names of files it sources, so I can try to work out where this sourcing is happen?

Was it helpful?

Solution

Doing

set -x

before

source .bashrc

would give a trace of commands being executed.

In order to filter source from the output, say

source .bashrc 2>&1 | grep source

OTHER TIPS

How about run bash in debug mode?

bash -x

Also you can imitate login with -l

bash -x -l

With that you could check how things happen.

And also, see if the array variable BASH_SOURCE could be helpful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top