In .bash_logout, do clearing and killing seperately.

This commit is contained in:
Darren 'Tadgy' Austin 2019-07-01 17:45:32 +01:00
commit eb17e766ef

View file

@ -13,9 +13,9 @@ if (( $SHLVL == 10 )); then
fi
fi
# Remove the SSH_AUTH_SOCK from the agents file.
(( $SHLVL == 1 )) && {
hash ssh-add ssh-agent >/dev/null 2>&1 && [[ ! -z "$SSH_AGENT_PID" ]] && [[ ! -z "$SSH_AUTH_SOCK" ]] && {
hash ssh-add ssh-agent >/dev/null 2>&1 && {
# Remove the SSH_AUTH_SOCK from the agents file.
[[ ! -z "$SSH_AUTH_SOCK" ]] && {
exec 9>~/.ssh/agents.lock
if flock -E 10 -w 0.5 9; then
_pop_agent_sock || {
@ -27,10 +27,16 @@ fi
_SLEEP=3
fi
exec 9>&-
ssh-agent -k >/dev/null 2>&1 || {
echo -e "$(tput setaf 1 || tput AF 1)Failed to kill ssh-agent!$(tput op)"
_SLEEP=3
}
# Kill the ssh-agent.
(( $SHLVL == 1 )) && {
[[ ! -z "$SSH_AGENT_PID" ]] && {
ssh-agent -k >/dev/null 2>&1 || {
echo -e "$(tput setaf 1 || tput AF 1)Failed to kill ssh-agent!$(tput op)"
_SLEEP=3
}
}
sleep ${_SLEEP:-0}
}
}
sleep ${_SLEEP:-0}