1

Extent of this question: https://unix.stackexchange.com/q/467025/256195

But now after run tmux inside sessionA to create sessionB, actually first tmux create a new named session 1 and I'd need to change the name to sessionB. How to?

I can change in command line (zsh>) and it works but in an zsh script, the output keep saying - I just copy and paste from script to command line and in command it works perfectly as I expected:

can't find session 1
can't find session 2

There's somehow tmux even in order in zsh script, zsh processes commands in unexpected behavior.

NOTE: I call tmux inside the first window of sessionA.

EDIT: in command line I can see session name 1 exist but when I try to rename it in zsh script it's failed, but in command it work.

2 Answers 2

0

I'm not sure I understand your question completely, but if you're working with tmux sessions inside tmux sessions, you have to use your binding key sequence twice, then the command key.

For example, if you wanted to split the nested tmux session in two panes, you'd use Ctrl+b, Ctrl+b, ", which assumes you have the default key binding.

1
  • Thanks but all is in an zsh script aspect, I'll update the answer now. Commented Sep 6, 2018 at 9:36
0

As my understanding now, there's no way to connect to get the right session name of unnamed session when you're in an zsh script, meaning after you create an unnamed session by calling tmux inside a tmux session, you'll be disabled from like rename-session -t2 - assuming that session indexed from 1.

But logically the new unnamed session comes from a window so should be rename-session -t1:1:2 <NewNAME>

t1:2:1 - t1 is session 1, :1 is window 1, :2 is new nested unnamed session.

Before create nested session we have 1 session, 1 window.

So the solution is we create new window and create session inside it with -s and -n explicitly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .