mac下source .bash_profile报/usr/local/etc/bash_completion错误处理

1.背景

在配置java环境变量之后,执行source .bash_profile命令之后,报出一系列/usr/local/etc/bash_completion的错误如下:

/usr/local/etc/bash_completion:59: command not found: shopt
/usr/local/etc/bash_completion:65: command not found: complete
/usr/local/etc/bash_completion:72: command not found: complete
/usr/local/etc/bash_completion:73: command not found: complete
/usr/local/etc/bash_completion:74: command not found: complete
/usr/local/etc/bash_completion:76: command not found: complete
/usr/local/etc/bash_completion:77: command not found: complete
/usr/local/etc/bash_completion:79: command not found: complete
/usr/local/etc/bash_completion:80: command not found: complete
/usr/local/etc/bash_completion:81: command not found: complete
/usr/local/etc/bash_completion:82: command not found: complete
/usr/local/etc/bash_completion:83: command not found: complete

2.解决办法

原因是.bash_profile多了这么一句

[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion

将其注释掉,再执行source .bash_profile即可

你可能感兴趣的:(//【杂谈或金点子记录】)