使用' cd' in terminal打印语法错误

时间:2016-04-23 14:26:23

标签: bash terminal

在更改终端中的目录时,我在命令行上获得额外的输出。输出是:

Casey-MacBook-Pro:~ casey$ cd Envs
-bash: command substitution: line 9: syntax error near unexpected token `done'
-bash: command substitution: line 9: `    done'
Caseys-MacBook-Pro:Envs casey$ 

有什么原因造成的?它可能是我的bash配置文件中的内容吗?当我运行subl~ / .bash_profile:

时,这就是我的bash配置文件的样子
# MacPorts Installer addition on 2013-03-02_at_20:37:40: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
source /usr/local/bin/activate.sh

# MacPorts Installer addition on 2015-09-24_at_12:31:24: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.

export STORMPATH_API_KEY_ID=""
export STORMPATH_API_KEY_SECRET=""
export SENDGRID_API_KEY=""
export SECRET_KEY=""
export FLASK_CONFIG=""
export DEV_DATABASE_URL=""
export TEST_DATABASE_URL=""

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH

1 个答案:

答案 0 :(得分:1)

问题是virtualenvwrapper.sh正在将cd重新定义为破碎的内容。

尝试从~/.bash_profile评论这些内容并打开新的终端窗口。

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
source /usr/local/bin/virtualenvwrapper.sh
source /usr/local/bin/activate.sh