1. 程式人生 > >linux 解決 " command not found: shopt "的 "~/.bashrc" 配置問題

linux 解決 " command not found: shopt "的 "~/.bashrc" 配置問題

之前使用的是 bash,自從使用 zsh 後,在執行 source ~/.bashrc 的時候出現下面的 command not found 的錯誤。

下面是錯誤資訊

/home/trsky/.bashrc:16: command not found: shopt
/home/trsky/.bashrc:33: command not found: shopt
/home/trsky/.bashrc:116: command not found: shopt
/usr/share/bash-completion/bash_completion:51: command not found: shopt
/usr/share/bash-completion/bash_completion:57: command not found: complete
/usr/share/bash-completion/bash_completion:62: command not found: complete
/usr/share/bash-completion/bash_completion:65: command not found: complete
/usr/share/bash-completion/bash_completion:68: command not found: complete
/usr/share/bash-completion/bash_completion:71: command not found: complete
/usr/share/bash-completion/bash_completion:74: command not found: complete
/usr/share/bash-completion/bash_completion:77: command not found: complete
/usr/share/bash-completion/bash_completion:80: command not found: complete
/usr/share/bash-completion/bash_completion:83: command not found: complete
/usr/share/bash-completion/bash_completion:86: command not found: complete
/usr/share/bash-completion/bash_completion:89: command not found: complete
/usr/share/bash-completion/bash_completion:92: command not found: complete
/usr/share/bash-completion/bash_completion:1996: parse error near `\n'


輸出錯誤資訊 


這裡有個 stack overflow 的迴應資訊 
shopt command not found in .bashrc after shell updation 

解決 
博主在 linux 上利用 Anaconda 同時配置了多個版本的 python ,在修改了~/.bashrc 檔案企圖更改系統預設的 python 之後 ,在 zsh 上執行了 source ~/.bashrc 。很明顯這是個錯誤的認識

好吧,正確的做法如下:

將所需配置修改寫入~/.zshrc
執行 source ~/.zshrc
--------------------- 
作者:種子選手 
來源:CSDN 
原文:https://blog.csdn.net/qq_36148847/article/details/79261067 
版權宣告:本文為博主原創文章,轉載請附上博文連結!