Re: reading an environment variable from screen [SOLVED]

2020-12-17 Thread Michael Grant
On Thu, Dec 17, 2020 at 10:46:43AM -0500, Michael Grant wrote: > Slight change to my previous message: > > > if [ -n "$STY" ]; then > function fix_ssh_auth_sock() { > screen -S $STY -X colon "msgwait 0\r" > export SSH_AUTH_SOCK=`screen -S $STY -Q echo '$SSH_AUTH_SOCK\r'` >

Re: reading an environment variable from screen [SOLVED]

2020-12-17 Thread Michael Grant
Slight change to my previous message: if [ -n "$STY" ]; then function fix_ssh_auth_sock() { screen -S $STY -X colon "msgwait 0\r" export SSH_AUTH_SOCK=`screen -S $STY -Q echo '$SSH_AUTH_SOCK\r'` screen -S $STY -X colon "msgwait 5\r" } export PROMPT_COMMAND=fix_

Re: reading an environment variable from screen [SOLVED]

2020-12-17 Thread Michael Grant
> In that case, this solution can be expanded a bit to do what you > want. The basic idea would be: > 1. On login, create a directory $HOME/.ssh/sockets/$TIME/ and put >a file setting the variables correctly in there (for example, >name the file $HOME/.ssh/sockets/$TIME/sshenv). In that cas

Re: reading an environment variable from screen

2020-12-17 Thread Thomas Köhler
Hi Michael, On Wed, Dec 16, 2020 at 01:28:15PM -0500, Michael Grant wrote: [...] > 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:

Re: reading an environment variable from screen

2020-12-16 Thread Neal Fultz
> 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

Re: reading an environment variable from screen

2020-12-16 Thread Michael Grant
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

Re: reading an environment variable from screen

2020-12-16 Thread Neal Fultz
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') Getting the shell quoting correct will probably be pretty fiddly though. On Wed, Dec 16, 2020 at 7:09 AM Michael Grant wrote: > > When I reattach to screen, the SSH_AUT

Re: reading an environment variable from screen

2020-12-16 Thread Thomas Köhler
Hi Michael, On Wed, Dec 16, 2020 at 03:08:45PM +, Michael Grant wrote: > 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-xx. > > Is ther

reading an environment variable from screen

2020-12-16 Thread Michael Grant
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-xx. Is there some way to interrogate screen to tell me what the contents of an environment variable