From bed2c80ef5174bc4b1d77443bbc48702fcdd6352 Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Sat, 23 May 2026 11:33:28 +0200 Subject: feat!: in add-sshagent-init, avoid typing the same passphrase more than once --- .bash/aliases.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.bash/aliases.bash b/.bash/aliases.bash index acf7091..20274ad 100644 --- a/.bash/aliases.bash +++ b/.bash/aliases.bash @@ -91,12 +91,14 @@ alias sshr='ssh -o StrictHostKeyChecking=no' alias sshk='ssh -o PasswordAuthentication=yes -o PreferredAuthentications=keyboard-interactive,password -o PubkeyAuthentication=no' alias sshg="ssh-with-gpg" function add-sshagent-init { - for KEY in "${SSHKEYS[@]}";do + declare -a ADDKEYS + for KEY in "${SSHKEYS[@]}"; do FFPRINT="$(ssh-keygen -Esha256 -lf "$KEY")" || return 1 if ! ssh-add -l 2>/dev/null | grep "$FFPRINT" >/dev/null; then - ssh-add -q "$KEY" + ADDKEYS+=( "$KEY" ) fi done + ssh-add -q "${ADDKEYS[@]}" } alias sshmaster='ssh -O' # ----- FS ----- # -- cgit v1.2.3