From f69fa3387a1a6f20edd301bda8f9c8cc00cf5aea Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Tue, 19 Feb 2019 00:07:42 -0500 Subject: Add a check to see if the SSH agent is running, if not start it and write the environment settings to a predictable location --- mkshrc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mkshrc') diff --git a/mkshrc b/mkshrc index 36c37d8..758313d 100644 --- a/mkshrc +++ b/mkshrc @@ -358,6 +358,16 @@ timestamp() { date +%m.%d.%y_%H.%M.%S } +checkSSHAgent() { + ssh_agent_conf="$HOME/.ssh/agent" + if [ -e "$ssh_agent_conf" ] ; then + . "$ssh_agent_conf" + fi + if ! ps -eo pid | grep -q "$SSH_AGENT_PID" ; then + ssh-agent -s | grep -v echo > "$ssh_agent_conf" + . "$ssh_agent_conf" + fi +} pull() { url="" -- cgit v1.2.3