aboutsummaryrefslogtreecommitdiffstats
path: root/ssh-agent-setup.sh
diff options
context:
space:
mode:
authorEduardo Pedroni <e.pedroni91@gmail.com>2015-11-01 16:09:36 +0100
committerEduardo Pedroni <e.pedroni91@gmail.com>2015-11-01 16:09:36 +0100
commit48bd2dee17a7293fe5329534afac31f913dc4b71 (patch)
tree403a9660e84eeb6c4989731af0b0d299886a1b7d /ssh-agent-setup.sh
parentbdd700ee0c78e2908ccc82770cf575055a029e6a (diff)
Initial commitHEADmaster
Diffstat (limited to 'ssh-agent-setup.sh')
-rw-r--r--ssh-agent-setup.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/ssh-agent-setup.sh b/ssh-agent-setup.sh
new file mode 100644
index 0000000..8b2ab98
--- /dev/null
+++ b/ssh-agent-setup.sh
@@ -0,0 +1,8 @@
+# Starts the ssh-agent if it is not running, and either way sources the required environment variables.
+
+if [ -z "$(ps -e | grep ssh-agent)" ]; then
+ # ssh-agent does not seem to be running, start it
+ ssh-agent | sed -r '/echo Agent pid [0-9]+;/d' > ~/.sshsession
+fi
+
+eval $(<~/.sshsession)