0

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?

gregseth
  • 193
  • 2
  • 8

1 Answers1

1

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.

larsks
  • 43,623
  • 14
  • 121
  • 180