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

时间:2020-04-07 07:49:25

标签: tmux

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

1 个答案:

答案 0 :(得分:2)

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

curl "https://www.syride.com/scripts/ajx_vols.php?p=/en/flights/&idPays=0&pseudo=0&typePratique=0&page=01&idSpot=0&recherche=&order=&tri=&l=en" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0" -H "Accept: */*" -H "Accept-Language: en-US,en;q=0.5" --compressed -H "X-Requested-With: XMLHttpRequest" -H "DNT: 1" -H "Connection: keep-alive" -H "Referer: https://www.syride.com/en/flights/&idPays=0&pseudo=0&typePratique=0&page=01&idSpot=0&recherche=&order=&tri=" -H "Cookie: instruments2=5ai6jgg9p6bpkh3m7slf0b2vq7; gb__ssyride=aufnlupslr259o49nc98qm1t55" -H "Cache-Control: max-age=0"

或者您可以使用#!/bin/sh S=$(tmux new -dP -smysession 'myprogram1') W=$(tmux neww -dP -t$S 'myprogram2') tmux -t$W splitw 'myprogram3' 或从tmux source-file加载的tmux脚本:

.tmux.conf

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

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