简体   繁体   中英

Sourcing .bash_profile doesn't return

I have an access to a Dreamhost subdomain on which I'm trying to run a Django REST app. The server runs on Ubuntu 12.04.5 LTS. Something went wrong in my virtual environment, so I'm trying to follow Dreamhost's instructions to install Python again. I get stuck at step 4:

. ~/.bash_profile

The command doesn't return, and I have to interrupt it to get back. Here's my .bashrc:

# ~/.bashrc: executed by bash(1) for non-login shells.

export NVM_DIR="/home/julius/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm
source .bash_profile

and here's my .bash_profile:

# ~/.bash_profile: executed by bash(1) for login shells.

umask 002
PS1='[\h]$ '
. $HOME/.bashrc
export PATH=$HOME/opt/python-3.5.1/bin:$PATH

What am I doing wrong?

You have infinite recursion when loading .bashrc or .bash_profile since they both source each other. You should probably remove the call to . $HOME/.bashrc . $HOME/.bashrc to prevent this.

It never returns because it can never complete. Your .bash_profile sources your .bashrc , which in turns sources ( . s) your .bash_profile , which sources your .bashrc , which ...

The bash source command (or . , which is just another name for the same thing) is not like a require or import statement that only happens once. It is an runtime command that executes the source d file every time it's encountered.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM