Tmux - split window with custom environment variables

I want to split the current tmux window and inherit its current environment.

I need to do this programmatically, so I cannot do this through a predefined configuration file.

Simply put, I want to do something like

tmux split-window my-binary 

my-binary is in my current PATH, but not in normal (it seems tmux just goes through my bash_profile).

Is it possible? Or do I need to run bash and configure env before running my-binary?

+4
source share
1 answer

To split the window where your default shell instance will be launched, use the env command, which launches everything configured as default-command in your ~/.tmux.conf :

 tmux split-window "env FOO=bar $(tmux show-options -vg default-command)" 
0
source

Source: https://habr.com/ru/post/1486990/


All Articles