Files
q-tools/web/tmuxssh
2016-07-21 12:09:31 +03:00

34 lines
698 B
Bash
Executable File

#!/bin/bash
HELP="
Arguments: hostnames, or username@hostnames
ctrl-b m to toggle pane synchronization
ctrl-b arrows to move between tiles
ctrl-b space to switch layout
TMUXSSH_OPTIONS variable for ssh command line options
"
[[ -z "$1" ]] && {
echo "$HELP"
exit
}
[[ "$1" = "-h" ]] && {
echo "$HELP"
exit
}
tmux new-session -d -s ssh$USER$$ "ssh $TMUXSSH_OPTIONS $1"
tmux set-window-option -t:0 synchronize-panes on
tmux bind-key m setw synchronize-panes
tmux rename-window 'SSH'
for (( i=2; i<=$#; i++ ))
do tmux split-window -h "ssh $TMUXSSH_OPTIONS ${!i}"
tmux select-layout main-vertical
done
tmux select-pane -t ssh$USER$$:SSH.0
tmux -2 attach-session -t ssh$USER$$