How to write a shell script that runs commands in separate terminals?
up vote
1
down vote
favorite
I've never written a script before, and I need help with my first one.
I have 3 commands, that need to run in order, in separate windows.
How do i write a script that I can execute, that runs command one, command two, and command three, in order, in separate windows?
I have tried making sense out of other posts, but haven't had any luck
command-line bash scripts
add a comment |
up vote
1
down vote
favorite
I've never written a script before, and I need help with my first one.
I have 3 commands, that need to run in order, in separate windows.
How do i write a script that I can execute, that runs command one, command two, and command three, in order, in separate windows?
I have tried making sense out of other posts, but haven't had any luck
command-line bash scripts
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I've never written a script before, and I need help with my first one.
I have 3 commands, that need to run in order, in separate windows.
How do i write a script that I can execute, that runs command one, command two, and command three, in order, in separate windows?
I have tried making sense out of other posts, but haven't had any luck
command-line bash scripts
I've never written a script before, and I need help with my first one.
I have 3 commands, that need to run in order, in separate windows.
How do i write a script that I can execute, that runs command one, command two, and command three, in order, in separate windows?
I have tried making sense out of other posts, but haven't had any luck
command-line bash scripts
command-line bash scripts
asked Oct 13 '16 at 8:52
Andy Bennett
2112
2112
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
4
down vote
You can do it just by calling three instances of your terminal emulator and telling them to stay open with exec bash
Example:
#!/bin/bash
mate-terminal -x bash -c 'uname -r; exec bash'
mate-terminal -x bash -c 'uname -m; exec bash'
mate-terminal -x bash -c 'uname -s; exec bash'
The first terminal pops up with 4.4.0-42-generic
second one with x86_64
, third one with Linux
...
If you're using vanilla Ubuntu, then replace mate-terminal
with gnome-terminal
or whatever app you use. Replace uname -[rms]
with your commands. You may find you need to use -e
and not -x
for gnome-terminal.
Help from this answer posted by Chaos
add a comment |
up vote
0
down vote
Assume that the commands are command_1, command_2 .. command_n. Then do the following
(You can also use terminal
, or konsole
, or gnome-terminal
, instead of xterm
, as mentioned here ).
$ xterm -e command_1
$ xterm -e command_2
.
.
$ xterm -e command_n
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
You can do it just by calling three instances of your terminal emulator and telling them to stay open with exec bash
Example:
#!/bin/bash
mate-terminal -x bash -c 'uname -r; exec bash'
mate-terminal -x bash -c 'uname -m; exec bash'
mate-terminal -x bash -c 'uname -s; exec bash'
The first terminal pops up with 4.4.0-42-generic
second one with x86_64
, third one with Linux
...
If you're using vanilla Ubuntu, then replace mate-terminal
with gnome-terminal
or whatever app you use. Replace uname -[rms]
with your commands. You may find you need to use -e
and not -x
for gnome-terminal.
Help from this answer posted by Chaos
add a comment |
up vote
4
down vote
You can do it just by calling three instances of your terminal emulator and telling them to stay open with exec bash
Example:
#!/bin/bash
mate-terminal -x bash -c 'uname -r; exec bash'
mate-terminal -x bash -c 'uname -m; exec bash'
mate-terminal -x bash -c 'uname -s; exec bash'
The first terminal pops up with 4.4.0-42-generic
second one with x86_64
, third one with Linux
...
If you're using vanilla Ubuntu, then replace mate-terminal
with gnome-terminal
or whatever app you use. Replace uname -[rms]
with your commands. You may find you need to use -e
and not -x
for gnome-terminal.
Help from this answer posted by Chaos
add a comment |
up vote
4
down vote
up vote
4
down vote
You can do it just by calling three instances of your terminal emulator and telling them to stay open with exec bash
Example:
#!/bin/bash
mate-terminal -x bash -c 'uname -r; exec bash'
mate-terminal -x bash -c 'uname -m; exec bash'
mate-terminal -x bash -c 'uname -s; exec bash'
The first terminal pops up with 4.4.0-42-generic
second one with x86_64
, third one with Linux
...
If you're using vanilla Ubuntu, then replace mate-terminal
with gnome-terminal
or whatever app you use. Replace uname -[rms]
with your commands. You may find you need to use -e
and not -x
for gnome-terminal.
Help from this answer posted by Chaos
You can do it just by calling three instances of your terminal emulator and telling them to stay open with exec bash
Example:
#!/bin/bash
mate-terminal -x bash -c 'uname -r; exec bash'
mate-terminal -x bash -c 'uname -m; exec bash'
mate-terminal -x bash -c 'uname -s; exec bash'
The first terminal pops up with 4.4.0-42-generic
second one with x86_64
, third one with Linux
...
If you're using vanilla Ubuntu, then replace mate-terminal
with gnome-terminal
or whatever app you use. Replace uname -[rms]
with your commands. You may find you need to use -e
and not -x
for gnome-terminal.
Help from this answer posted by Chaos
edited Apr 13 '17 at 12:24
Community♦
1
1
answered Oct 13 '16 at 9:18
Zanna
48.9k13123234
48.9k13123234
add a comment |
add a comment |
up vote
0
down vote
Assume that the commands are command_1, command_2 .. command_n. Then do the following
(You can also use terminal
, or konsole
, or gnome-terminal
, instead of xterm
, as mentioned here ).
$ xterm -e command_1
$ xterm -e command_2
.
.
$ xterm -e command_n
add a comment |
up vote
0
down vote
Assume that the commands are command_1, command_2 .. command_n. Then do the following
(You can also use terminal
, or konsole
, or gnome-terminal
, instead of xterm
, as mentioned here ).
$ xterm -e command_1
$ xterm -e command_2
.
.
$ xterm -e command_n
add a comment |
up vote
0
down vote
up vote
0
down vote
Assume that the commands are command_1, command_2 .. command_n. Then do the following
(You can also use terminal
, or konsole
, or gnome-terminal
, instead of xterm
, as mentioned here ).
$ xterm -e command_1
$ xterm -e command_2
.
.
$ xterm -e command_n
Assume that the commands are command_1, command_2 .. command_n. Then do the following
(You can also use terminal
, or konsole
, or gnome-terminal
, instead of xterm
, as mentioned here ).
$ xterm -e command_1
$ xterm -e command_2
.
.
$ xterm -e command_n
edited Apr 13 '17 at 12:23
Community♦
1
1
answered Oct 13 '16 at 10:01
Nizar Malangadan
584
584
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f836410%2fhow-to-write-a-shell-script-that-runs-commands-in-separate-terminals%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown