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)
|
## 1. in zlogin (for a new shell)
|
||||||
## 2. with recossh alias to load a new ssh-agent
|
## 2. with recossh alias to load a new ssh-agent
|
||||||
function load-ssh-agent() {
|
function load-ssh-agent() {
|
||||||
## If a ssh-key is available
|
# If a ssh-key is available
|
||||||
## AND ssh-agent not launched
|
if find "${HOME}/.ssh" -maxdepth 1 -type f -iname "id_*" | grep -q -- .; then
|
||||||
if find "${HOME}/.ssh" -maxdepth 1 -type f -iname "id_*" > /dev/null 2>&1 &&
|
## If ssh-agent is not already launched
|
||||||
! ps -x | grep -v grep | grep -Fq -- "ssh-agent -a ${SSH_AGENT_SOCK}"; then
|
if ! ps -x | grep -v grep | grep -Fq -- "ssh-agent -a ${SSH_AGENT_SOCK}"; then
|
||||||
### Remove any previous socket and environment files
|
### Remove any previous socket and environment files
|
||||||
rm --force -- "${SSH_AGENT_SOCK}" "${SSH_AGENT_ENV}"
|
rm --force -- "${SSH_AGENT_SOCK}" "${SSH_AGENT_ENV}"
|
||||||
### Start ssh-agent with a specified socket path
|
### Start ssh-agent with a specified socket path
|
||||||
|
@ -335,6 +335,7 @@ function load-ssh-agent() {
|
||||||
fi
|
fi
|
||||||
## Load content of ssh-agent environment file
|
## Load content of ssh-agent environment file
|
||||||
source "${SSH_AGENT_ENV}"
|
source "${SSH_AGENT_ENV}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
# Add ed25519 ssh-key to ssh-agent {{{
|
# Add ed25519 ssh-key to ssh-agent {{{
|
||||||
|
|
Loading…
Reference in New Issue