I'm trying to script the spawning of GNU/screen windows by using commands of the form
For some reason when I start GNU/screen (by hand), the shell that it starts in window 0 (
/bin/bash) does not contain a
$STY environment variable. Without this commands like
screen vim start a nested screen session, not another window as I want.
My environment is somewhat unusual. Here's how I end up in it:
ssh robm@somehost sudo su sharedaccount script /dev/null screen
script /dev/null step exists because the TTY device allocated for the
robm user cannot be accessed by the
sharedaccount user. The
script command allocates a new TTY that is owned by the user that invoked it, solving that problem.
If I skip the
script steps, GNU/screen sets
$STY just fine. In other words this works just fine:
ssh robm@somehost screen
Presumably something about
script interferes with
screen, but I'm stumped as to what.