diff options
Diffstat (limited to '%HOME%/.profile')
-rw-r--r-- | %HOME%/.profile | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/%HOME%/.profile b/%HOME%/.profile index 401947b..b1e7153 100644 --- a/%HOME%/.profile +++ b/%HOME%/.profile @@ -59,3 +59,21 @@ python_setup() { python_setup python3 python [ -r "$HOME/.pythonrc" ] && export PYTHONSTARTUP="$HOME/.pythonrc" + +# ssh-agent + +kill_ssh_agent() { + [ -n "${SSH_AGENT_PID:+x}" ] && kill "$SSH_AGENT_PID" +} + +spawn_ssh_agent() { + local output + [ -z "${SSH_AGENT_PID:+x}" ] \ + && command -v ssh-agent > /dev/null 2>&1 \ + && output="$( ssh-agent -s )" \ + && eval "$output" > /dev/null \ + && [ -n "${SSH_AGENT_PID:+x}" ] \ + && trap kill_ssh_agent EXIT +} + +spawn_ssh_agent |