我在 Mac OSX Lion 上,不知何故在安装 mysql 和 postgres 时,我的 .bash_profile 上的导出 PATH 行被弄乱或删除。
所以我在一个空的 .bash_profile 中添加了这个:
export PATH=/usr/local/bin:/usr/sbin:/usr/local/sbin:/usr/bin
Run Code Online (Sandbox Code Playgroud)
但是我无法执行任何 bash 命令:
/usr/bin $ ls
-bash: ls: command not found
/usr/bin $ /bin/echo $PATH
/usr/local/bin:/usr/sbin:/usr/local/sbin:/usr/bin
Run Code Online (Sandbox Code Playgroud)
我的 .bashrc 可能但不相关,但以防万一:
[[ -s "/Users/jer/.rvm/scripts/rvm" ]] && source "/Users/jer/.rvm/scripts/rvm"
function _git_prompt() {
local git_status="`git status -unormal 2>&1`"
if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then
if [[ "$git_status" =~ nothing\ to\ commit ]]; then
local ansi=42
elif [[ "$git_status" =~ nothing\ added\ …Run Code Online (Sandbox Code Playgroud)