Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I know that the current session name can be accessed with the $STY environment variable, is there a way to get the session name of the parent screen session in case of nested screens?

share|improve this question
add comment

1 Answer

I don't believe this is possible; $STY is really the only place to get this information and the old value is masked by the nested screen. You could rename screen to screen-real and replace it with a shell script that did something like this:

#!/bin/sh

if [ "$STY" ]; then
    export PARENT_STY=$STY
fi
exec $0-real "$@"

This would get you access to $PARENT_STY inside a nested screen, but it would only work for a single level of nesting. If you really wanted to you could get substantially more complicated (e.g., treating PARENT_STY like a list and appending values), but that doesn't seem worth the effort.

share|improve this answer
    
Maybe screen -ls helps. –  fboaventura Jan 16 '13 at 1:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.