Use eval to kill ssh agent.
This commit is contained in:
parent
925cafb5d6
commit
d2bbee39fc
1 changed files with 1 additions and 2 deletions
|
|
@ -16,10 +16,9 @@ fi
|
||||||
hash ssh-add ssh-agent >/dev/null 2>&1 && {
|
hash ssh-add ssh-agent >/dev/null 2>&1 && {
|
||||||
# Stop any started ssh-agent as long as the shell level is 1 and we're not on a tty.
|
# Stop any started ssh-agent as long as the shell level is 1 and we're not on a tty.
|
||||||
(( SHLVL == 1 )) && [[ "$(tty)" == /dev/pts/* ]] && [[ -n "$SSH_AGENT_PID" ]] && {
|
(( SHLVL == 1 )) && [[ "$(tty)" == /dev/pts/* ]] && [[ -n "$SSH_AGENT_PID" ]] && {
|
||||||
eval "$(ssh-agent -k)"
|
eval "$(ssh-agent -k)" >/dev/null
|
||||||
(( $? != 0 )) && printf "\\033[1;31;40m%s\\033[0;39m\\n" "Failed to stop ssh-agent." >&2
|
(( $? != 0 )) && printf "\\033[1;31;40m%s\\033[0;39m\\n" "Failed to stop ssh-agent." >&2
|
||||||
sleep 5
|
sleep 5
|
||||||
unset SSH_AGENT_PID SSH_AUTH_SOCK
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update the ~/.ssh/agents file.
|
# Update the ~/.ssh/agents file.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue