網上有很多source命令找不到的教程。但是沒有關於CloudStudio的情況。
sh: 25: source: not found
sudo: source:找不到命令
具體原因是因爲CloudStudio用的是sh的shell。
但是source 是在bash的shell中的。
原因: ls -l `which sh` 提示/bin/sh -> dash
這說明是用dash來進行解析的。
改回方法:
命令行執行:sudo dpkg-reconfigure dash
在界面中選擇no
再ls -l `which sh` 提示/bin/sh -> bash
以上方法無法解決CloudStudio的問題。
直接切換到root用戶後執行卻找不到shopt命令
因此使用exec bash
exec bash
成功source ~/.bashrc