From 2e3fbc8fac07a70ddc5f9f1cc5ed258cac15b4ff Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Sun, 22 Mar 2026 02:01:11 -0500 Subject: [PATCH] ssh: Use idiomatic zsh array operations instead of sed/grep forks --- modules/ssh/init.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ssh/init.zsh b/modules/ssh/init.zsh index 6bf237c..fca663a 100644 --- a/modules/ssh/init.zsh +++ b/modules/ssh/init.zsh @@ -27,7 +27,7 @@ if [[ ! -S "$SSH_AUTH_SOCK" ]]; then # Start ssh-agent if not started. if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then 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 @@ -39,7 +39,7 @@ if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then fi # 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' # ssh-add has strange requirements for running SSH_ASKPASS, so we duplicate # them here. Essentially, if the other requirements are met, we redirect stdin