Skip to content

Instantly share code, notes, and snippets.

@WMcKibbin
Created August 12, 2019 15:07
Show Gist options
  • Save WMcKibbin/d72351d75e05a49c995859147bb73a0d to your computer and use it in GitHub Desktop.
Save WMcKibbin/d72351d75e05a49c995859147bb73a0d to your computer and use it in GitHub Desktop.
Quick and dirty sync'd ssh to multiple servers
#!/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