blob: 9935934366a07518d93b18243d891ecee80a12c8 [file] [log] [blame]
carlosmscabralf40ecd12013-02-01 18:15:58 -02001SSH_ENV="$HOME/.ssh/environment"
2
3function start_agent {
4 echo "Initialising new SSH agent..."
5 /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
6 echo succeeded
7 chmod 600 "${SSH_ENV}"
8 . "${SSH_ENV}" > /dev/null
9 /usr/bin/ssh-add;
10}
11
12# Source SSH settings, if applicable
13
14if [ -f "${SSH_ENV}" ]; then
15 . "${SSH_ENV}" > /dev/null
16 #ps ${SSH_AGENT_PID} doesn't work under cywgin
17 ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
18 start_agent;
19 }
20else
21 start_agent;
22fi
23
24source ~/.bashrc