有没有办法将会话的TMUX ID获取到该会话中运行的Python程序中?
我只是想知道是否可以在tmux会话中运行python脚本并获得其ID-就像我有tmux会话ID:1,我想运行一个Python程序,其中一个变量应为TMUX会话的ID它正在运行,在这种情况下为1。
I just wanted to to know if it is possible to run a python script in a tmux session and get its ID - like if I have a tmux session id: 1, I want to run a python program where one of it's variable should be the ID of the tmux session it is running in, In this case 1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了。在键“ TMUX” AS/TMP // TMUX-1000/DEFAULT,4795,0下的环境变量中可用。在我的情况下,最后一个数字是tmux_id。
这就是我目前正在使用的,但是显然有一种更好的方法来拆分字符串以获取ID。
Found it. In it is available in environment variables under key "TMUX" as /tmp//tmux-1000/default,4795,0. Where the last digit is the tmux_id in my case.
This is what I am using for now, but obviously there is a better way to split the string to get the ID.