Skip to content

Instantly share code, notes, and snippets.

@andrewd-uriux
andrewd-uriux / .bashrc
Created January 7, 2021 07:46 — forked from frederickding/.bashrc
Share a ssh-agent between WSL bash instances, but kill it when the last instance closes
# add to .bashrc
# Set up ssh-agent
SSH_ENV="$HOME/.ssh/environment"
function start_ssh_agent {
echo "Initializing new SSH agent..."
touch $SSH_ENV
chmod 600 "${SSH_ENV}"
/usr/bin/ssh-agent | sed 's/^echo/#echo/' >> "${SSH_ENV}"