diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-07-19 02:46:12 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-07-19 02:46:12 +0300 |
commit | 71cf8955a212bb046b6fdfd07d60aae3ce49ee6d (patch) | |
tree | dc695c63dcb588a0121829353b1e183208ae5286 | |
parent | code style (diff) | |
download | linux-home-71cf8955a212bb046b6fdfd07d60aae3ce49ee6d.tar.gz linux-home-71cf8955a212bb046b6fdfd07d60aae3ce49ee6d.zip |
spawn_ssh_agent: bugfix
-rw-r--r-- | .bash_profile | 15 |
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 )" |