linux - Open gnome-terminal from shell script and hold window open -
i'm trying write script sets programming environment taking argument name of project(directory) want open
so example: ./my_script.sh sample_app
and here script far:
#!/bin/bash wmctrl -s 0 sublime & sleep 2 wmctrl -s 1 google-chrome & sleep 2 wmctrl -s 2 dir="$echo /home/bitnumb/projects/ruby/workspace/$1" echo $dir gnome-terminal --window-with-profile=guard -e ls & #gnome-terminal -e cd /home/bitnumb/projects/ruby/workspace/$1 && bundle exec guard & #gnome-terminal -e cd /home/bitnumb/projects/ruby/workspace/$1 && rails s &
the problem arises when script executes:
gnome-terminal --window-with-profile=guard -e ls &
i message the child process exited status 0.
:
i can't use terminal after (i can close it) , message hides part of output. , yet, have created profile , set when command exits dropdown menu 'hold terminal open'...
** i left comments in script can idea of i'm trying do
to execute multiple commands in same gnome-terminal window, use semicolons ;
separators below:
gnome-terminal -- bash -c "command 1; command 2; ...; bash;"
the last command bash
starts command-line interpreter terminal doesn't exit @ end (use $shell
instead of bash
more general solution).
this way won't need define profile option hold terminal open when command exits , won't message the child process exited status 0
(which hide parts of output).
here might write (i use backslashes \
split lines):
gnome-terminal -- bash -c \ " ls ;\ cd /home/bitnumb/projects/ruby/workspace/$1 && bundle exec guard ;\ cd /home/bitnumb/projects/ruby/workspace/$1 && rails s;\ $bash;"
Comments
Post a Comment