Reputation: 12107
I have a script that pushes multiple builds at the same time, using the parallel command.
Typically, either everything works, or nothing does, but it's not a very robust way to do it.
the script is like:
parallel ::: 'docker push a' 'docker push b' 'docker push c'
Is there a way, using bash where I could make an array of the commands, like
commands = (docker push a' 'docker push b' 'docker push c')
and then open a tmux window with a pane per task and run each task in its own pane? so I would see all the outputs separately.
In practice, I'm on MacOS using zsh, but a bash compliant solution would be more portable.
Upvotes: 0
Views: 1363
Reputation:
Something like:
for i in a b c; do
if [ -z "$W" ]; then
W=$(tmux neww -P "docker push $i")
else
tmux splitw -t$W "docker push $i" \; selectl tiled
fi
done
You may want to set the remain-on-exit
option on the window if you don't want the panes to close until you have read the output.
There is also stuff like https://github.com/greymd/tmux-xpanes although I have not used it.
Upvotes: 2