简体   繁体   English

在osx升级后获取bash_profile后,所有bash命令都会丢失

[英]All bash commands lost after sourcing bash_profile after osx upgrade

I recently upgraded my osx to os x el capitan. 我最近将osx升级到os x el capitan。 I noticed that subl command was missing so I tried adding the path to my bash_profile. 我注意到缺少了subl命令,所以我尝试将路径添加到我的bash_profile中。 It didn't work out so I removed it and then do a source ~/.bash_profile and now all of my bash commands are gone. 它没有成功,所以我将其删除,然后执行source ~/.bash_profile ,现在我所有的bash命令都消失了。

Here is my bash_profile file 这是我的bash_profile文件

export $PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

##
# Your previous /Users/judyngai/.bash_profile file was backed up as /Users/judyngai/.bash_profile.macports-saved_2013-06-27_at_16:30:58
##

# MacPorts Installer addition on 2013-06-27_at_16:30:58: 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 PATH=/usr/local/sbin:$path
export PATH=/usr/local/bin:$PATH


export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
:q!

and when I do export $PATH 当我export $PATH

I am getting this 我得到这个

31-34-238:bin judyngai$ export $PATH -bash: export: `/usr/local/bin:/usr/local/sbin:': not a valid identifier

I cd into all of the directories that its getting searched through /usr/local/bin , /bin , /usr/local/bin etc. and saw all of the commands in there. 我进入通过/usr/local/bin/bin/usr/local/bin等搜索的所有目录,并在那里看到了所有命令。

and this 和这个

31-34-238:~ judyngai$ source ~/.bash_profile
-bash: export: `/Users/judyngai/.rbenv/bin:/usr/local/bin:/usr/local/sbin:=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin': not a valid identifier
env: bash: No such file or directory
-bash: :q!: command not found

I actually think my bash_profile is fine so what is wrong? 我实际上认为我的bash_profile很好,那么怎么了? Rbenv and macport both look fine. Rbenv和macport看起来都不错。

This line is destroying your path: export PATH=/usr/local/sbin:$path -- variables are case sensitive. 这行代码正在破坏您的路径: export PATH=/usr/local/sbin:$path变量区分大小写。

However, this error 但是,这个错误

-bash: export:`/usr/local/bin:/usr/local/sbin:': not a valid identifier

Indicates you probably have this in your bash_profile 表示您的bash_profile中可能有这个

export PATH=/usr/local/sbin:$path       # PATH=/usr/local/sbin:
export PATH=/usr/local/bin:$PATH        # PATH=/usr/local/bin:/usr/local/sbin:
export $PATH="$HOME/.rbenv/bin:$PATH"
# .....^

Where you are substituting the variable on the left-hand side instead of providing the variable name . 您在左侧替换变量的位置,而不是提供变量名称

You export a variable (name), not a variable's value. 您导出变量(名称),而不是变量的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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