dotfiles/bin/executable_find-agent.sh
2021-12-17 18:49:10 +01:00

17 lines
401 B
Bash
Executable File

#!/bin/bash
#
# Add keys to ssh-agent
# TODO: make keys configurable
#
if [[ $_ = $0 ]]; then
echo "Script is a subshell, will source it: source $0"
exit 42
else
SSH_AUTH_SOCK=$(find /tmp/ -name 'agent*' -printf "%T@ %Tc %p\n" | sort -n | tail -1 | awk '{print $7}')
echo -e "$SSH_AUTH_SOCK"
export SSH_AUTH_SOCK
ssh-add ~/.ssh/daimler_rsa
ssh-add ~/.ssh/materna-ecdsa
fi