I have a command I want to execute in .bashrc only when the current terminal
window is managed by GNU screen. How do I do this? Is there an environment variable for it? I used to have
if [ -n "$WINDOW" ]; then
command
fi
But from what I can tell, $WINDOW may or may not be defined across all screen
managed sessions.
Check for the environment variable $STY (contains info about the screen) or for $TERM being 'screen' (probably less reliable).
signine is correct
See the doc
http://www.gnu.org/software/screen/manual/html_node/Environment.html
STYAlternate socket name. If
screenis invoked, and the environment variableSTYis set, then it creates only a window in the runningscreensession rather than starting a new session.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With