Created
April 19, 2012 12:45
-
-
Save nailor/2420774 to your computer and use it in GitHub Desktop.
Open ssh connections from stdin to multiple tmux panes
This file contains 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
multitmux() { | |
read first; | |
tmux -q new-session -d -s $1 "ssh -t $first"; | |
tmux set-option quiet on | |
tmux -q set-option -t $1 mouse-select-pane on | |
tmux -q set-window -g -t $1 synchronize-panes on | |
while read host; do | |
tmux -q split-window -p 25 -v -t $1 "ssh -t $host" 2>/dev/null; | |
if [ "$?" == "1" ]; then | |
# If pane is too small, change layout and retry opening | |
tmux -q next-layout | |
tmux -q split-window -p 25 -v -t $1 "ssh -t $host"; | |
fi | |
tmux -q select-layout -t $1 tiled; | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment