Re: reading an environment variable from screen

Michael Grant <mgrant-q2t/[email protected]> Wed, 16 Dec 2020 13:28:15 -0500
Newsgroups gmane.comp.gnu.screen.user
Message-ID <X9pRv17umI4P/[email protected]>
On Wed, Dec 16, 2020 at 09:15:09AM -0800, Neal Fultz wrote:
> There is not a getenv command to match setenv iirc.
> 
> There's a -Q flag for query - z=$(screen -S $STY -Q echo '$SSH_AUTH_SOCK')

Thanks, this is even closer.  z is being set, but it outputs something to
the screen which does go away after a few seconds.  Any idea how to
stop it from doing that?  I wonder if there's some code I could output
that turned off display output, did this command, then turn it back on
again?

I couldn't use this in an alias as it would disrupt the screen each
time I ran ssh or scp.  But it does get the necessary info.

Thomas, what you suggest, it's similar to the people who suggest symlinking some known place to the /tmp folder and then setting that in the environment.  Here's a link to the superuser.com post about this:

https://superuser.com/questions/180148/how-do-you-get-screen-to-automatically-connect-to-the-current-ssh-agent-when-re

You're right, it works a most of the time.  Where it fails is if I log
in a second time from a different computer.  I was just looking to see
if I could fix that.

Michael
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEDXVee01gWrPIdWPRwgRAue7sYQMFAl/aUbwACgkQwgRAue7s
YQMYgA//c7d7OczSWwzNOirv8334eXgEIhxeVYFWCkukSEj11x/oD/wWlMXSFCfX
9LsjaJKJWdyf3VzbmOVgVOE0lTWOdhysV/EjxjhfxrkAzU3oqxqDsDeD2ZDCCABj
VJCozWEfCygANY00zdQs4xg3DkXZ815ABmxyJ7/8usm2vzI1d3s10P6fsBc6JGuC
K9I0FsxjxbF7qFcbGhnXkZbp7u2BvgOZY2G6GbxBr3KIAhTRJCJe5HwKb8zfQZPB
06CEfUSmbSw0rslkWpoxDJ9pYFYJW1/ZBKhZC49u4bgiOza81Vexj8ZUdR4bHS9e
s4kJPtvGwMuMOxlu+XB2xJW26NqBmuVCdNsKudjdWgtAuxLRXy2ln8nt3Q0wzrUy
v5Ek4feRXFvj+uXXssUC2dZIemStbYx0KRTxF6llA73nkI3w1bxHj0G9kgTNpgaG
w43WFDmGAeJxpzbn3IwamzUv0QamvGQ1kjIXDNazw7nU6FcvJ9eaHtBO/k9KiqGD
5ZS58ZvRghiBPJf8i06upzOIeXPlVbnnA303qkvdV6DX01wbkZr9Ijy5as0e7e52
mm/H6h0wFeTLXIpKfKfmJxX0FE4OaCVwlAE4Ulvn7c3W1lHLhSM1EoYDLQVQtA/a
rhT/T81twU2snR5DXYjDqailwZ9N+4hKn2mIVvtVWV4poKX81h8=
=OZvN
-----END PGP SIGNATURE-----