aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.bash_profile15
1 files changed, 6 insertions, 9 deletions
diff --git a/.bash_profile b/.bash_profile
index 6944194..f068405 100644
--- a/.bash_profile
+++ b/.bash_profile
@@ -44,16 +44,13 @@ fi
# fi
spawn_ssh_agent() {
- if [ -z "${SSH_AGENT_PID:+x}" -o -z "${SSH_AUTH_SOCK:+x}" ]; then
- local ssh_agent="$( command -v ssh-agent )" || return $?
- eval "$( "$ssh_agent" -s )" > /dev/null || return $?
- trap "kill $SSH_AGENT_PID" 0
- ssh-add || return $?
- fi
+ [ ! -z "${SSH_AGENT_PID:+x}" ] && return 0
+
+ eval "$( ssh-agent -s )" > /dev/null \
+ && trap "$( printf 'kill %q' "$SSH_AGENT_PID" )" 0 \
+ && ssh-add &> /dev/null
}
-if [ "$( uname -o )" == 'Cygwin' ]; then
- spawn_ssh_agent
-fi
+[ "$( uname -o )" == 'Cygwin' ] && spawn_ssh_agent
echo "Welcome to $( hostname )"