Bash on Ubuntu on Windows 启动参数

Bash on Ubuntu on Windows start parameter

嘿嘿 我想用启动参数在 windows 上启动 bash.exe,然后让 shell 打开。 我为此找到了 msdn page,但是如果我尝试 运行 它,例如bash -c "ls" , bash 之后已经关闭。

我想在我的桌面上有一个 link,我在其中输入了 ssh 的登录命令。所以 shell 应该保持打开状态,而不是执行命令然后退出。

来自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 [=10=].

因此,对于 -c,shell 不是交互式的。如果你想要在初始命令 运行 之后进行交互式 shell,请从 运行ning bash [=23= 开始另一个交互式 bash shell ].

以你的例子,它将是:

bash -c 'ls; exec bash'