打开GNOME终端编程和被处决的.bashrc后执行命令 [英] Open gnome terminal programmatically and execute commands after bashrc was executed

查看:223
本文介绍了打开GNOME终端编程和被处决的.bashrc后执行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试建立一个小脚本,开始我的开发环境。对于任务,我试图打开一个GNOME终端与在自动导轨服务器和自动测试启动几个选项卡。

I try to build a little script to start my development environment. For that task I try to open a gnome terminal with several tabs where automatically the rails server and autotest is started. But

gnome-terminal --tab -e "rails server" --tab --tab

不工作(错误创建子进程)。
此外

does not work ("error creating the child process"). Also


gnome-terminal --tab -e "bash -c \"rails server\"" --tab --tab` 

不起作用。
任何建议如何解决这个问题?

does not work. Any suggestions how to solve that problem?

推荐答案

下面是我们在<一个摸索出一个不错的把戏href=\"http://superuser.com/questions/198015/open-gnome-terminal-programmatically-and-execute-commands-after-bashrc-was-execut\">Superuser


  1. 添加的eval$ BASH_POST_RC来后,你的的.bashrc

设置BASH_POST_RC环境变量对每个选项卡,你要执行该命令,例如: Gnome终端 - 工作目录=/家/ zardoz /项目/ my_rails_app - -Tab -e'的bash -c出口BASH_POST_RC = \\导轨服务器\\; EXEC庆典'--tab -e'的bash -c出口BASH_POST_RC = \\自动测试\\; EXEC庆典

Set the BASH_POST_RC environment variable for each tab to that command you like to execute, e.g.: gnome-terminal --working-directory="/home/zardoz/projects/my_rails_app" --tab -e 'bash -c "export BASH_POST_RC=\"rails server\"; exec bash"' --tab -e 'bash -c "export BASH_POST_RC=\"autotest\"; exec bash"'

:感谢您的解决方案

这篇关于打开GNOME终端编程和被处决的.bashrc后执行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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