Fix condition to launch ssh-agent
This commit is contained in:
parent
c6efe15908
commit
8cea44ecc4
9
zshrc
9
zshrc
|
@ -323,10 +323,10 @@ alias josm="java -jar -Xmx2048M /opt/josm-tested.jar"
|
|||
## 1. in zlogin (for a new shell)
|
||||
## 2. with recossh alias to load a new ssh-agent
|
||||
function load-ssh-agent() {
|
||||
## If a ssh-key is available
|
||||
## AND ssh-agent not launched
|
||||
if find "${HOME}/.ssh" -maxdepth 1 -type f -iname "id_*" > /dev/null 2>&1 &&
|
||||
! ps -x | grep -v grep | grep -Fq -- "ssh-agent -a ${SSH_AGENT_SOCK}"; then
|
||||
# If a ssh-key is available
|
||||
if find "${HOME}/.ssh" -maxdepth 1 -type f -iname "id_*" | grep -q -- .; then
|
||||
## If ssh-agent is not already launched
|
||||
if ! ps -x | grep -v grep | grep -Fq -- "ssh-agent -a ${SSH_AGENT_SOCK}"; then
|
||||
### Remove any previous socket and environment files
|
||||
rm --force -- "${SSH_AGENT_SOCK}" "${SSH_AGENT_ENV}"
|
||||
### Start ssh-agent with a specified socket path
|
||||
|
@ -335,6 +335,7 @@ function load-ssh-agent() {
|
|||
fi
|
||||
## Load content of ssh-agent environment file
|
||||
source "${SSH_AGENT_ENV}"
|
||||
fi
|
||||
}
|
||||
# }}}
|
||||
# Add ed25519 ssh-key to ssh-agent {{{
|
||||
|
|
Loading…
Reference in New Issue