From 436e670ca1c40c2db271d1f0767ce5478b2a5d9e Mon Sep 17 00:00:00 2001 From: tombdf Date: Thu, 19 Dec 2024 17:04:25 +0100 Subject: [PATCH] Update .bashrc --- dot_bashrc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dot_bashrc b/dot_bashrc index 4513b48..7b2172d 100644 --- a/dot_bashrc +++ b/dot_bashrc @@ -123,6 +123,19 @@ if ! shopt -oq posix; then fi fi +# Set the ssh-agent +if ! pgrep -u "$USER" ssh-agent > /dev/null; then + eval "$(ssh-agent -s)" > /dev/null +fi +export SSH_AUTH_SOCK=$(ssh-agent -s | grep -oP '(?<=SSH_AUTH_SOCK=)[^;]+') +# Add the keys to the agent +if [ -f ~/.ssh/id_ed25519 ] && ! ssh-add -l | grep -q id_ed25519; then + ssh-add ~/.ssh/id_ed25519 > /dev/null 2>&1 +fi +if [ -f ~/.ssh/hexasec ] && ! ssh-add -l | grep -q hexasec; then + ssh-add ~/.ssh/hexasec > /dev/null 2>&1 +fi + eval "$(zoxide init --cmd cd bash)" eval "$(oh-my-posh init bash)"