2016-12-11 28 views
1

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

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

+1

后,你只是想在shell窗口是开放的,或者你希望它是一个交互的shell窗口?对于第一种情况,请尝试'bash -c“ls;读取-n1 -p'按任意键退出...'”'。否则,对于后者的情况,尝试'bash -c“ls; exec bash”' – anishsane

+0

@anishsane是的,第二个是我想要的和它的工作。谢谢 ! – Twiebie

回答

2

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,请从运行bash shell启动另一个交互式bash shell。

你的榜样,这将是:在命令完成

bash -c 'ls; exec bash' 
相关问题