前提是WSL中zsh不使用root默认登录的.
卸载zsh后忘记把bash换回来或者某些奇怪情况提示zsh not found
导致bash不能启动成功,
可以把WSL的默认登录用户改成root, 用root账号更改原来账号的.bashrc
文件
在CMD下运行lxrun
能得到一堆帮助提示
Usage:
/install - Installs the subsystem
Optional arguments:
/y - Do not prompt user to accept or create a subsystem user
/uninstall - Uninstalls the subsystem
Optional arguments:
/full - Perform a full uninstall
/y - Do not prompt user to confirm
/setdefaultuser - Configures the subsystem user that bash will be launched as. If the user does not exist it will be created.
Optional arguments:
username - Supply the username
/y - If username is supplied, do not prompt to create a password
/update - Updates the subsystem's package index
用/setdefaultuser命令把默认登录账号改为root
lxrun /setdefaultuser root
登录bash
bash
找到原账号的文件夹,修改它的.bashrc
vi .bashrc
找到这段并注释掉
if [ -t 1 ]; then
exec zsh
fi
:wq
保存后运行source .bashrc
生效.
退出bash后继续用lxrun /setdefaultuser xxx
切换原来的账号, 试试.