有没有一种方法可以自动在tmux中创建会话和窗格的过程

问题描述 投票:0回答:1

我拥有在tmux会话中运行的大量程序列表有什么简单的方法可以让我们指定会话名称并指定哪个窗格运行哪个程序。

tmux
1个回答
0
投票

是的,您可以使用shell脚本中的tmux命令执行此操作,例如:

#!/bin/sh

S=$(tmux new -dP -smysession 'myprogram1')
W=$(tmux neww -dP -t$S 'myprogram2')
tmux -t$W splitw 'myprogram3'

或者您可以使用tmux source-file或从.tmux.conf加载的tmux脚本:

new -smysession 'myprogram1'
neww 'myprogram2'
splitw 'myprogram3'

或者您可以查看许多现有的包装程序来执行此操作。最受欢迎的是:

https://github.com/rothgar/awesome-tmux#tools-and-session-management处有一个列表。

© www.soinside.com 2019 - 2024. All rights reserved.