Add script to ensure ssh agent is running to bash
This commit is contained in:
parent
362c5f3682
commit
ac60eb45ee
14
bash/ensure-ssh-agent
Normal file
14
bash/ensure-ssh-agent
Normal file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ENVFILE=~/.bash/ssh-agent.env
|
||||
|
||||
if [ -f $ENVFILE ] ; then
|
||||
. $ENVFILE > /dev/null
|
||||
if ! kill -0 $SSH_AGENT_PID > /dev/null 2>&1; then
|
||||
eval $(ssh-agent | tee $ENVFILE)
|
||||
ssh-add
|
||||
fi
|
||||
else
|
||||
eval $(ssh-agent | tee $ENVFILE)
|
||||
ssh-add
|
||||
fi
|
||||
Loading…
Reference in New Issue
Block a user