Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
updating the shell environment in screen (was Re: prompt and ssh)
- X-seq: zsh-users 14165
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: updating the shell environment in screen (was Re: prompt and ssh)
- Date: Sun, 24 May 2009 15:26:33 -0700
- In-reply-to: <20090521074103.GN27141@xxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <e7db6e960905190954j7be72739p6b521bca8e90fe7f@xxxxxxxxxxxxxx> <20090519200217.35368.qmail@xxxxxxxxxxx> <20090521074103.GN27141@xxxxxxxxxxxxxxxxxxx>
On Thu, May 21, 2009 at 09:41:03AM +0200, Vincent Lefevre wrote:
> 3. Later, log on the machine directly (without ssh) and recall the
> screen session. SSH_CONNECTION is still set (as the environment
> doesn't change in the recalled shell)
Here's what I do to ensure that my screen sessions always have updated
environment info:
In my ~/.zshrc file:
alias scr=' ~/bin/update_screenenv; screen -R -d -i'
function preexec {
[ -e ~/.screenenv ] && . ~/.screenenv
# ... among other things ...
}
The ~/bin/update_screenenv script:
#!/bin/zsh
for var in SSH_AUTH_SOCK SSH_AGENT_PID DISPLAY WINDOWID SSH_TTY SSH_CLIENT SSH_CONNECTION SESSION_MANAGER; do
if [[ -n "${(P)var}" ]]; then
echo "export $var='${(P)var}'"
else
echo "unset $var"
fi
done >~/.screenenv
What this does for me is to update the ~/.screenenv file every time I
connect to my screen session (which I always do via my 'scr' alias).
Since my shells all source the ~/.screenenv file before every command,
the environment stays updated with the info from the latest parent shell
that connected to screen.
..wayne..
Messages sorted by:
Reverse Date,
Date,
Thread,
Author