diff options
author | Robby Russell <robby@planetargon.com> | 2010-09-30 20:53:19 -0700 |
---|---|---|
committer | Robby Russell <robby@planetargon.com> | 2010-09-30 20:53:19 -0700 |
commit | 321f5ef3596b5a3a1fb6cb40c0b19f041cde7ee2 (patch) | |
tree | b471af450fa358470821cddbe848603b3f01a879 | |
parent | c9c65bf7fcf21bf939e55dfc0108076e477f5e03 (diff) | |
parent | 62cea310fb97a98f6360397dfeef3a01507153fd (diff) | |
download | zsh-321f5ef3596b5a3a1fb6cb40c0b19f041cde7ee2.tar.gz zsh-321f5ef3596b5a3a1fb6cb40c0b19f041cde7ee2.tar.bz2 zsh-321f5ef3596b5a3a1fb6cb40c0b19f041cde7ee2.zip |
Merge branch 'ssh-agent' of http://github.com/gwjo/oh-my-zsh into gwjo-ssh-agent
-rw-r--r-- | plugins/ssh-agent.plugin.zsh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/plugins/ssh-agent.plugin.zsh b/plugins/ssh-agent.plugin.zsh new file mode 100644 index 000000000..fa8c45ea2 --- /dev/null +++ b/plugins/ssh-agent.plugin.zsh @@ -0,0 +1,24 @@ +# Based on code from Joseph M. Reagle +# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html + +local SSH_ENV=$HOME/.ssh/environment + +function start_agent { + /usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV} + chmod 600 ${SSH_ENV} + . ${SSH_ENV} > /dev/null + /usr/bin/ssh-add; +} + +# Source SSH settings, if applicable + +if [ -f "${SSH_ENV}" ]; then + . ${SSH_ENV} > /dev/null + #ps ${SSH_AGENT_PID} doesn't work under cywgin + ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { + start_agent; + } +else + start_agent; +fi + |