Created
August 12, 2019 15:07
-
-
Save WMcKibbin/d72351d75e05a49c995859147bb73a0d to your computer and use it in GitHub Desktop.
Quick and dirty sync'd ssh to multiple servers
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 | |
# Assume session is 0 | |
tmux attach-session -t 0 | |
WINDOW=$(tmux display-message -p "#I") | |
FIRST_ARG="" | |
for arg in $*; do | |
if [[ $arg != *"%"* ]]; then | |
if [[ $FIRST_ARG == "" ]]; then | |
FIRST_ARG=$arg | |
tmux send-keys "ssh $arg" Enter | |
else | |
tmux split-window "ssh $arg" | |
fi | |
tmux select-layout tiled | |
fi | |
done | |
tmux set-window-option synchronize-panes on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment