我现在使用 tmux 2.9 时出现此错误,而使用 tmux 2.7 时没有问题。
[15:02:59] nod @ server01: ~ $> ssh-multi2_1.sh server10 server11
usage: new-window [-adkP] [-c start-directory] [-F format] [-n window-name] [-t target-window] [command]
protocol version mismatch (client 7, server 8)
protocol version mismatch (client 7, server 8)
protocol version mismatch (client 7, server 8)
protocol version mismatch (client 7, server 8)
[15:07:49] nod @ server01: ~ $>
#!/bin/bash
# ssh-multi
# D.Kovalov
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
# a script to ssh multiple servers over multiple tmux panes
# TMUX 2.1+
# ./ssh-multi.sh server{01..16}
starttmux() {
if [ -z "$HOSTS" ]; then
echo -n "Please provide of list of hosts separated by spaces [ENTER]: "
read HOSTS
fi
local hosts=( $HOSTS )
local target="ssh-multi ${host[0]}"
tmux new-window -n "${target}" ssh ${hosts[0]}
unset hosts[0];
for i in "${hosts[@]}"; do
tmux split-window -t :"${target}" -h "ssh $i"
tmux select-layout -t :"${target}" tiled > /dev/null
done
tmux select-pane -t 0
tmux set-window-option -t :"${target}" synchronize-panes on > /dev/null
}
HOSTS=${HOSTS:=$*}
starttmux
答案1
协议版本 7 上次用于 tmux 1.8,此后一直使用 8。所以我猜你没有运行你期望运行的 tmux 二进制文件。