diff options
| author | mail_redacted_for_web | 2022-07-06 09:30:28 +0200 | 
|---|---|---|
| committer | mail_redacted_for_web | 2022-07-06 09:30:28 +0200 | 
| commit | 8bf3be857b622fcbe6c49933a3ee7379b514aef1 (patch) | |
| tree | 47f862235b199f298234cfa79e2886ef6c029dd0 | |
| parent | c079713f467eea6edaa3ad3e658774e40666644c (diff) | |
| download | dotfiles-8bf3be857b622fcbe6c49933a3ee7379b514aef1.tar.bz2 | |
Only add SSH key if it's not been added yet.
Currently, ```ssh-add -l``` displays the fingerprint the same way
```ssh-keygen -Esha256 -lf``` does. Simple comparison, done.
| -rw-r--r-- | .bash/aliases.bash | 5 | 
1 files changed, 4 insertions, 1 deletions
| diff --git a/.bash/aliases.bash b/.bash/aliases.bash index d104328..c6650e0 100644 --- a/.bash/aliases.bash +++ b/.bash/aliases.bash @@ -73,7 +73,10 @@ alias sshk='ssh -o PasswordAuthentication=yes -o PreferredAuthentications=keyboa  alias sshg="ssh-with-gpg"  function add-sshagent-init {  	for KEY in "${SSHKEYS[@]}";do -		ssh-add "$KEY" +		FFPRINT="$(ssh-keygen -Esha256 -lf "$KEY")" +		if ! ssh-add -l 2>/dev/null | grep "$FFPRINT" >/dev/null; then +			ssh-add "$KEY" +		fi  	done  }  # ----- FS ----- # | 
