Mac系统修改.bash_profile文件改坏了,导致除cd以外的命令基本失效
如:
-bash: ls: command not found
-bash: shutdown: command not found
-bash: reboot: command not found
-bash: vi: command not found
此时还可以使用shell脚本的绝对路径操作
1.打开.bash_profile文件
方式一:
/usr/bin/vim ~/.bash_profile
方式二:
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
open -e ~/.bash_profile
2.打开.bash_profile文件之后把之前的错误修改干掉,一般是PATH赋值有问题
保存并强制退出
:wq!
3.退出后使配置生效
source ~/.bash_profile
稍微等一会基本既可以恢复
// 参考文章
https://blog.csdn.net/yuanfang_jlht/article/details/53101695
https://www.cnblogs.com/jzxy/p/11535306.html
http://www.bloguan.com/?id=536