I'm using screen (the problematically named terminal session manager) on a remote system accessed over SSH - to run long running processes and such. I have eventually started using a command to attach directly to the screen session, instead of first logging in through SSH and then start screen:
ssh -t hostname screen -xRR
The use of the
-xRR is to attach to the existing screen session, if available, otherwise just create a new one. The problem is that when a new session is created, it is not created as a login shell:
$ shopt -q login_shell; echo $?
and as a result, login session setup (running
.profile and friends) isn't done and then parts of the setup is missing, compared to first using SSH to login and then running
screen - in which case the shell SSH starts is a login shell and it is setup properly and screen I guess inherits the environment.
I tried using the
-l flag on screen, which is documented as "Login mode", but it doesn't help - I think it only updates the "login time" for things like
Any idea how to get screen to run a login shell?