在Windows上启动参数的Ubuntu上的Bash

时间:2016-12-11 11:35:20

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

平, 我想在启动参数的Windows上启动bash.exe,并让shell打开。 我为此找到了msdn page,但如果我尝试使用例如bash -c" ls" ,bash已经关闭了。

我希望在桌面上有一个链接,我在其中输入ssh的登录命令。因此shell应保持打开状态,并且不会执行命令然后退出。

1 个答案:

答案 0 :(得分:4)

来自man bash

   -c        If the -c option is present, then commands are read from the first non-option
             argument command_string.  If there are arguments  after  the  command_string,
             they are assigned to the positional parameters, starting with $0.

因此,对于-c,shell不是交互式的。如果在运行初始命令后需要交互式shell,请从运行bash shell启动另一个交互式bash shell。

举个例子,它将是:

bash -c 'ls; exec bash'