Modify ssh-agent killing in .bash_logout.
This commit is contained in:
parent
af993e63fb
commit
57274f8d70
1 changed files with 2 additions and 4 deletions
|
|
@ -15,10 +15,8 @@ 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/tty* ]] && [[ -n "$SSH_AGENT_PID" ]] && {
|
||||||
eval "$(ssh-agent -k)" >/dev/null
|
eval "$(ssh-agent -k >/dev/null 2>&1)" >/dev/null || 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update the ~/.ssh/agents file.
|
# Update the ~/.ssh/agents file.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue