为什么我需要两次输入WSL以使其正常工作?

时间:2017-05-04 08:29:52

标签: windows bash windows-subsystem-for-linux

首先,我进入了WSL,但它看起来异常 - 没有颜色和别名:

Abnormally bash

如果我再次进入bash,一切都会正常工作:

Normally bash

安装后没有WSL的快捷方式,所以我创建了一个:

My shortcut

但问题似乎出现在最近的内部构建中。我的Windows版本是16184.1001。

那我的WSL出了什么问题?

1 个答案:

答案 0 :(得分:0)

解决。请参阅https://github.com/Microsoft/BashOnWindows/issues/2067

  

@0xbadfca11在16184之前,bash的argv [0]是' / bin / bash'。这是非登录shell。 Bash只会加载.bashrc。   从16184开始,bash的argv [0]是' -bash'。这是登录shell。 Bash只加载.bash_profile或.bash_login或.profile中的第一个。不要看.bashrc。但是,默认的.profile将执行.bashrc。   当使用优先级高于.profile的.bash_profile或.bash_login时,让我们自己加载.bashrc。   即使' -l'添加.bashrc,因为有些文件的优先级高于.profile。

相关问题