Created
February 26, 2015 22:35
-
-
Save rafer/6b334a0fa0318e95283d to your computer and use it in GitHub Desktop.
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 -e | |
if [[ $# -ne 1 ]]; then | |
echo "Simultaneous SSH session in tmux panes, courtesy of knife search" | |
echo "Usage: knifemux [knife search expression]" | |
exit 1 | |
fi | |
tmux start-server | |
tmux new-session -d -s knifemux | |
for host in `knife search -i "$1" | tail +3` | |
do | |
tmux splitw -t knifemux "ssh $host" | |
tmux select-layout -t knifemux tiled | |
done | |
tmux kill-pane -t 0 | |
tmux set-window-option -t knifemux synchronize-panes on | |
tmux at -t knifemux |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment