bash 如何获取当前附加的屏幕会话名称?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16848940/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I get currently attached screen session name?
提问by ertan
I'm writing a script which needs the name of the currently attached screen session's name if there's any.
我正在编写一个脚本,如果有的话,它需要当前附加的屏幕会话的名称。
回答by Martin Mrazik
You might want to check answers here: How do I display the current "session" name or "sockname" of a screen session in the status bar?
您可能想在此处查看答案:如何在状态栏中显示屏幕会话的当前“会话”名称或“sockname”?
In short the $STY environment variable is what you are looking for.
简而言之, $STY 环境变量就是您要寻找的。

