4

I've noticed that

  1. tmux will share variable between sessions.
  2. tmux will increment TMUX_PANE for new session as well.

Is it possible to reset VAR for each session?

Is it possible to start TMUX_PANE from 0 for each session?

# set variable
# create 2 sessions
$ export VAR=aaaaa
$ tmux new -A -s $VAR -d

$ export VAR=bbbbb
$ tmux new -A -s $VAR -d

$ tmux ls
aaaaa: 1 windows (created Fri Jan 23 12:12:46 2015) [207x50]
bbbbb: 1 windows (created Fri Jan 23 12:12:55 2015) [207x50]

# connect to sessions
# check value of variable
$ tmux att -t aaaaa
$ echo $VAR
aaaaa

$ tmux att -t bbbbb
$ echo $VAR
aaaaa            <-------- i would like to see 'bbbbb' here

1 Answer 1

3

I've found workaround.

Multiple servers with -L option (which specifies socket name).

# set variable
# create 2 sessions
$ export VAR=aaaaa
$ tmux -L $VAR new -A -s $VAR -d

$ export VAR=bbbbb
$ tmux -L $VAR new -A -s $VAR -d

$ tmux ls
failed to connect to server
$ tmux -L aaaaa ls
aaaaa: 1 windows (created Fri Jan 23 12:12:46 2015) [207x50]
$ tmux -L bbbbb ls
bbbbb: 1 windows (created Fri Jan 23 12:12:55 2015) [207x50]

# connect to sessions
# check value of variable
$ tmux -L aaaaa att -t aaaaa
$ echo $VAR
aaaaa

$ tmux -L bbbbb att -t bbbbb
$ echo $VAR
bbbbb            <-------- now i can see 'bbbbb' here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.