[dev] ssh-agent stanza in POSIX shell

From: Sime Ramov <s_AT_ramov.com>
Date: Sun, 30 Oct 2011 20:04:53 +0100

I've found the following clever ssh-agent stanza in Richard Crowley's
`.profile`[https://raw.github.com/rcrowley/home/master/.profile]:

which ssh-agent >/dev/null && {
        : ${SSH_AUTH_SOCK:=$(echo /tmp/ssh-*/agent.* | cut -d" " -f1)}
        [ -S "$SSH_AUTH_SOCK" ] && {
                export SSH_AUTH_SOCK
        } || {
                eval $(ssh-agent)
                ssh-add
        }
}

Wondering why it doesn't work properly in OpenBSD ksh as I am not so
good with POSIX sh.

It works partially, i.e. it spawns a new agent on every shell
invocation.
Received on Sun Oct 30 2011 - 20:04:53 CET

This archive was generated by hypermail 2.3.0 : Sun Oct 30 2011 - 20:12:03 CET