Zprofile ssh-agent fix for when no agent is running but .env file exists.

This commit is contained in:
Viyurz 2024-02-21 13:59:55 +01:00
parent 71f025f4a0
commit d610225c84
Signed by: Viyurz
SSH key fingerprint: SHA256:IskOHTmhHSJIvAt04N6aaxd5SZCVWW1Guf9tEcxIMj8

View file

@ -1,5 +1,5 @@
# SSH Agent
if [[ ! -f "$XDG_RUNTIME_DIR/ssh-agent.env" ]]; then
if ! pgrep -u "$USER" ssh-agent > /dev/null || [[ ! -f "$XDG_RUNTIME_DIR/ssh-agent.env" ]]; then
pkill -u "$USER" -9 ssh-agent
ssh-agent > "$XDG_RUNTIME_DIR/ssh-agent.env"
fi