3

I would like to write a script that runs multiple programs/commands 'program1', 'program2', 'program3'... in a mosaic of terminal in one single window using gnome-terminal and also using tmux (I mean I want to know both ways).

How is it possible ?

I know that this topic mentions it, but it's not exactly what I want. Since I don't want the terminal to close when the program has finished.

Laurent Mesguen
  • 163
  • 1
  • 1
  • 6

2 Answers2

1

Put everything in a script like this:

#! /bin/bash
#
su -c '/usr/bin/tmux new-session -s "all" -d'
tmux send "path of Program 1" C-m
tmux rename-window "Program 1"

tmux new-window
tmux send "path of Program 2" C-m
tmux rename-window "Program 2"

tmux new-window
tmux send "path of Program 3" C-m
tmux rename-window "Program 3"

tmux attach

It will start a new tmux session called all with 3 windows called Program1,Program2 and Program3 each one executing each program.

Even if a program stops the window won't close.

jcbermu
  • 4,626
  • 17
  • 26
1

You can keep the terminal open by following the command with something that waits for user input:

tmux new-window 'make ; read'

If your shell doesn't support the read builtin, you could use eg. sed -n q.

JigglyNaga
  • 7,706
  • 1
  • 21
  • 47