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
STY
Alternate socket name. If
screen
is invoked, and the environment variableSTY
is set, then it creates only a window in the runningscreen
session 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