mirror of
https://github.com/dcarrillo/prezto.git
synced 2026-04-19 07:34:06 +00:00
ssh: Use idiomatic zsh array operations instead of sed/grep forks
This commit is contained in:
@@ -27,7 +27,7 @@ if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
|
|||||||
# Start ssh-agent if not started.
|
# Start ssh-agent if not started.
|
||||||
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then
|
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then
|
||||||
mkdir -p "$_ssh_agent_env:h"
|
mkdir -p "$_ssh_agent_env:h"
|
||||||
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
|
eval "$(print -l "${(@)${(f)"$(ssh-agent)"}:#echo *}" | tee "$_ssh_agent_env")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Load identities.
|
# Load identities.
|
||||||
if ssh-add -l 2>&1 | grep -q 'The agent has no identities'; then
|
if [[ ${(@M)${(f)"$(ssh-add -l 2>&1)"}:#The agent has no identities*} ]]; then
|
||||||
zstyle -a ':prezto:module:ssh:load' identities '_ssh_identities'
|
zstyle -a ':prezto:module:ssh:load' identities '_ssh_identities'
|
||||||
# ssh-add has strange requirements for running SSH_ASKPASS, so we duplicate
|
# ssh-add has strange requirements for running SSH_ASKPASS, so we duplicate
|
||||||
# them here. Essentially, if the other requirements are met, we redirect stdin
|
# them here. Essentially, if the other requirements are met, we redirect stdin
|
||||||
|
|||||||
Reference in New Issue
Block a user