#!/bin/bash # Use Bitwarden's SSH agent only while Bitwarden is running it, so ssh and # ssh-add keep working with GNOME's agent for anyone who doesn't. A shell opened # before Bitwarden starts uses GNOME's agent; open a new one afterwards. LINE='if [ -S "$HOME/.bitwarden-ssh-agent.sock" ]; then export SSH_AUTH_SOCK="$HOME/.bitwarden-ssh-agent.sock"; fi' if grep -qF "$LINE" ~/.bashrc; then echo "Bitwarden SSH agent already configured in .bashrc" else echo "$LINE" >> ~/.bashrc echo "Bitwarden SSH agent added to .bashrc" fi