Fixes for variable handling around ssh-agent

This commit is contained in:
DarkFeather 2019-05-06 13:56:35 -05:00
parent 86cbdbbab9
commit 9fc65724ef
1 changed files with 2 additions and 2 deletions

View File

@ -46,9 +46,9 @@ if [ -f ~/.ssh/config ]; then
done
fi
# Tell shell about ssh-agent -- enable with 'systemctl enable ssh-agent@$USER.service'
SSH_AGENT_PID="$(ps -feu "$USER" | grep -v grep | grep -m 1 ssh-agent | awk '{ print $2; }')"
export SSH_AGENT_PID="$(ps -fu "$USER" | grep -v grep | grep -m 1 ssh-agent | awk '{ print $2; }')"
if [ -n "$SSH_AGENT_PID" ]; then
SSH_AUTH_SOCK="$(ls -1 /tmp/ssh-*/agent.$(( $SSH_AGENT_PID - 1 )))"
export SSH_AUTH_SOCK="$(ls -1 /tmp/ssh-*/agent.$(( $SSH_AGENT_PID - 1 )))"
echo ssh-agent PID is $SSH_AGENT_PID
fi
# Set up screen/tmux safety nest by default for remote sessions