X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/blobdiff_plain/af254ca9d25d12c361482c701799ca5e55454c09..b46a2fb26726c44a66f195846a7e2e73d40012f4:/bin/start-ssh-agent diff --git a/bin/start-ssh-agent b/bin/start-ssh-agent index 30c0bc7..6183ed5 100755 --- a/bin/start-ssh-agent +++ b/bin/start-ssh-agent @@ -29,6 +29,12 @@ case $chosen,$style in ;; esac +## Some useful variables. +hostname=${HOST-$(hostname)} +user=${USER-${LOGNAME-$(id -un)}} +dir=$TMPDIR/.ssh-agent.$hostname.$user +socket=$dir/sock; pid=$dir/pid + ### Should I start a new agent? case "$force,$SSH_AUTH_SOCK" in t,* | nil,) @@ -44,9 +50,6 @@ esac ### If so, do that case $foundp in nil) - hostname=${HOST-$(hostname)} - user=${USER-${LOGNAME-$(whoami)}} - dir=$TMPDIR/.ssh-agent.$hostname.$user; socket=$dir/sock; pid=$dir/pid mkdir -p -m700 "$dir" SSH_AUTH_SOCK=$socket; export SSH_AUTH_SOCK set +e; ssh-add -l >/dev/null 2>&1; rc=$?; set -e