Created
July 18, 2019 16:13
-
-
Save flxai/d167ccba12497f7b45918be3393759ae to your computer and use it in GitHub Desktop.
Run commands in tmux grid layout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run a number of commands within tmux in a grid layout | |
# Session name | |
s=exp | |
# Command | |
c="for i in {1..10}; do echo -n .; sleep 1; done; read" | |
if tmux has-session -t $s 2>/dev/null; then | |
echo "Session '$s' exists already, bailing out!" | |
exit 1 | |
fi | |
tmux new -ds $s | |
tmux set-option remain-on-exit on # FIXME Use something like read at the end | |
# of the command instead | |
for p in {0..8}; do | |
tmux split-window "$c" | |
tmux select-layout tiled # FIXME To circumvent pane too small | |
done | |
tmux kill-pane -t 1 | |
tmux select-layout tiled | |
tmux attach |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment