How do you tell if the current terminal session is in GNU screen?

Viewed 5462

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.

5 Answers
Related