When I reattach to screen, the SSH_AUTH_SOCK is wrong. I often ssh in and run screen simultaneously on a laptop and desktop. So I can’t use the trick of symlinking something to /tmp/ssh-xxxxxxxxxx.
Is there some way to interrogate screen to tell me what the contents of an environment variable are? Running this in a shell inside of screen: screen -S $STY -X colon 'exec |echo $SSH_AUTH_SOCK\r' gives me the info I’m looking for, but it pushes it out to the display. I’m so close! How can I capture this output? My goal here is to create a sort of ssh/scp pre-command as a shell alias that probes screen each time and sets the SSH_AUTH_SOCK variable correctly.