Open gnome terminal programmatically and execute commands after executing bashrc

I am trying to create a small script to start a development environment. For this task, I am trying to open the gnome terminal with several tabs, where the rails server and autotest are automatically launched. But

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

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

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

does not work. Any suggestions for resolving this issue?

+3
source share
5 answers

Here is a good trick we developed at Superuser

  • eval "$BASH_POST_RC" .bashrc

  • BASH_POST_RC , , : 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"'

@Gilles: !

+13

: , , , . /home/zardoz/bin/railsstart

#! /bin/sh
exec rails server

chmod +x it, do

gnome-terminal --tab -e /home/zardoz/bin/railsstart --tab --tab ...

, , , - strace -f -o /tmp/trace.log , , trace.log, , ( - , E, , "ENOEXEC", "ENOENT", "EPERM", - .)

: .bashrc :

#! /bin/bash
. ~/.bashrc
exec rails server

: .bashrc , , "" . , .

+1

, - , PATH , gnome-terminal .

rails script, PATH?

0

Already answered, but just in case, this stone that automates the terminal on the KDE, OSX and Gnome desktops.

0
source

for ubuntu 16.04

click Ctr+Shift+T

a new tab will open in the same window. in addition, a button for adding additional tabs will appear next to the rightmost tab.

0
source

Source: https://habr.com/ru/post/1768765/


All Articles