Created
February 16, 2022 20:30
-
-
Save antoniomika/81b81b908f057cd7aafc0df4d7c4aec9 to your computer and use it in GitHub Desktop.
syncssh
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
#!/bin/bash | |
starttmux() { | |
if [ -z "$HOSTS" ]; then | |
echo -n "Please provide of list of hosts separated by spaces [ENTER]: " | |
read HOSTS | |
fi | |
local hosts=( $HOSTS ) | |
tmux new-window "ssh ${hosts[0]}" | |
unset hosts[0]; | |
for i in "${hosts[@]}"; do | |
tmux split-window -h "ssh $i" | |
tmux select-layout tiled > /dev/null | |
done | |
tmux select-pane -t 0 | |
tmux set-window-option synchronize-panes on > /dev/null | |
} | |
HOSTS=${HOSTS:=$*} | |
starttmux |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment