Jer*_*ith 0 linux bash mac-osx
我在 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\ to\ commit\ but\ untracked\ files\ present ]]; then
local ansi=43
else
local ansi=45
fi
if [[ "$git_status" =~ On\ branch\ ([^[:space:]]+) ]]; then
branch=${BASH_REMATCH[1]}
test "$branch" != master || branch=' '
else
# Detached HEAD. (branch=HEAD is a faster alternative.)
branch="(`git describe --all --contains --abbrev=4 HEAD 2> /dev/null ||
echo HEAD`)"
fi
echo -n '\[\e[0;37;' "$ansi"';1m\]'"$branch"'\[\e[0m\] '
fi
}
function _prompt_command() {
PS1="\n `_git_prompt`"'\n \[\e[1;34m\]\w \$\[\e[0m\] '
}
PROMPT_COMMAND=_prompt_command
#export PS1='\n\[\033[1;33m\]\w\n\[\033[0m\]$(parse_git_branch)$ '
Run Code Online (Sandbox Code Playgroud)
你/bin也可能失踪了/sbin。
user@host ~ $ which ls
/bin/ls
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
580 次 |
| 最近记录: |