在 Linux 的 Windows 子系统中修复 .bashrc 中的“输入/输出错误”

uri*_*rig 5 windows bash windows-subsystem-for-linux

我错误地.bashrc使用 Windows 文本编辑器 (Notepad++) 为我的 WSL(Linux 的 Windows 子系统)Bash编辑了文件。

现在,每当我运行 Bash 时,都会出现以下错误:

bash: /root/.bashrc: 输入/输出错误

我怎样才能解决这个问题?我尝试使用 Linux 文件结尾(仅 LF)进行保存,但这没有用。

uri*_*rig 4

我找到了解决问题的最小方法。我的 WSL 正在运行 Ubuntu。在 Ubuntu 中,有一个原始.bashrc/etc/skel.

  1. 我删除了使用 Windows 资源管理器的错误副本.bashrc
  2. 在 Bash 中,我复制了原始副本,如下所示: cp /etc/skel/.bashrc ~/

(基于此 AskUbuntu 答案:https://askubuntu.com/questions/198730/how-to-restore-bashrc-file