加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

shell – Tmux创建窗口失败:使用中的索引:0

发布时间:2020-12-16 01:52:02 所属栏目:安全 来源:网络整理
导读:我有一个脚本,所以我想创建一个与各种服务器连接的 Windows的tmux会话: tmux new-session -d -s server-connectionstmux new-window -t server-connections:0 -n 't-u14-nickpl' 'ssh T-U14-NickPL'tmux new-window -t server-connections:1 -n 't-u12-dev1
我有一个脚本,所以我想创建一个与各种服务器连接的 Windows的tmux会话:

tmux new-session -d -s server-connections
tmux new-window -t server-connections:0 -n 't-u14-nickpl' 'ssh T-U14-NickPL'
tmux new-window -t server-connections:1 -n 't-u12-dev1' 'ssh T-U12-Dev1'
tmux attach -t server-connections

当我运行该文件时,我得到创建窗口失败:使用中的索引:0.起初我想也许脚本执行得如此之快,它在索引0处附加到窗口比命令可以运行得快,所以我介绍了一个睡眠只是要确定.

tmux new-session -d -s server-connections
tmux new-window -t server-connections:0 -n 't-u14-nickpl' 'ssh T-U14-NickPL'
tmux new-window -t server-connections:1 -n 't-u12-dev1' 'ssh T-U12-Dev1'
sleep 4
tmux attach -t server-connections

但我仍然得到创建窗口失败:使用索引:0然后睡眠将发生.

在索引0处需要更改为绑定到该窗口需要什么?

解决方法

新会话始终具有初始窗口,因此一旦新会话完成,就会采用窗口索引0.而不是显式的新窗口命令,只需使用new-session命令本身指定信息.

tmux new-session -d -s server-connections -n 't-u14-nickpl' 'ssh T-U14-NickPL'
tmux new-window -t server-connections:1 -n 't-u12-dev1' 'ssh T-U12-Dev1'
tmux attach -t server-connections

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读