调用的bash,运行命令里面的新的外壳,然后给控制权交还给用户 [英] Invoke bash, run commands inside new shell, then give control back to user

查看:98
本文介绍了调用的bash,运行命令里面的新的外壳,然后给控制权交还给用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这必须是非常简单的,或非常复杂的,但我无法找到任何关于它...我试图打开一个新的bash的实例,然后运行它里面的一些命令,并给控制回用户的同样的实例中

我试过:

  $庆典-licsome_command

但执行 some_command 新的实例中,然后将其关闭。我希望它继续开放。

一个细节可能影响回答:如果我能得到这个工作,我会用它在我的的.bashrc 作为别名(ES),因此加分的别名执行!


解决方案

 庆典--rcfile≤(回声〜/ .bashrc中; some_command')

免除临时文件的创建。在其他网站上的问题:

This must either be really simple or really complex, but I couldn't find anything about it... I am trying to open a new bash instance, then run a few commands inside it, and give the control back to the user inside that same instance.

I tried:

$ bash -lic "some_command"

but this executes some_command inside the new instance, then closes it. I want it to stay open.

One more detail which might affect answers: if I can get this to work I will use it in my .bashrc as alias(es), so bonus points for an alias implementation!

解决方案

bash --rcfile <(echo '. ~/.bashrc; some_command')

dispenses the creation of temporary files. Question on other sites:

这篇关于调用的bash,运行命令里面的新的外壳,然后给控制权交还给用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆