从 tmux 会话内部创建新的 tmux 会话 [英] Create new tmux session from inside a tmux session

查看:41
本文介绍了从 tmux 会话内部创建新的 tmux 会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 shell 脚本,用于创建/附加或切换到给定的会话,具体取决于一个会话是否在 tmux 中以及会话是否存在.

I'm writing a shell script that creates / attaches or switches to a given session, depending on whether one is inside tmux and the session exists.

除了需要从 tmux 会话中创建新的 tmux 会话的情况外,我的一切都运行良好.

I've got everything working great except for the case requiring the creation of a new tmux session from within a tmux session.

当我的脚本执行 tmux new-session -s name 时,我得到以下输出:

When my script executes tmux new-session -s name, I get the following output:

会话应该小心嵌套,取消设置 $TMUX 以强制

sessions should be nested with care, unset $TMUX to force

我实际上并不想嵌套会话,我的目标是创建另一个单独的会话并从 tmux 会话中切换到它.

I don't actually want to nest sessions, my goal is to create another separate session and switch to it from within a tmux session.

这可能吗?

推荐答案

最快的方法(假设您使用 ctrl-b 作为命令前缀)是:

The quickest way (assuming you use ctrl-b as your command prefix) is:

ctrl-b :new

要创建一个新会话,然后

To create a new session, then

ctrl-b s

以交互方式选择并附加到会话.

to interactively select and attach to the session.

这篇关于从 tmux 会话内部创建新的 tmux 会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆