Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Is zsh buggy in connection with screen?



I have a similar problem with ssh-agent. New screen windows
automatically get the updated environment when I've shelled freshly
into the machine, but existing shells in windows need to run
"latestssh."

# the problem with screen is that old sessions lose ssh-agent awareness. this
# little system fixes it.
local agentdir=~/.latestssh
local agentfile=$agentdir/$HOST.sh
mkdir -p $agentdir
chmod 0700 $agentdir >/dev/null
if [ -n "$SSH_AUTH_SOCK" -a -z $STY ]; then
    echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >$agentfile
    chmod 0600 $agentfile >/dev/null
fi
# ...existing windows can run this alias
alias latestssh="source $agentfile; ls \$SSH_AUTH_SOCK"
# ...new windows get it automatically
if [ -n "$STY" ]; then
    source $agentfile
fi

--
Ian Langworth



Messages sorted by: Reverse Date, Date, Thread, Author