# .ssh_agent
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 1997-2016 California Institute of Technology.
# Copyright (c) 2016-2025 The Uncertainty Quantification Foundation.
# License: 3-clause BSD.  The full license text is available at:
#  - https://github.com/uqfoundation/pox/blob/master/LICENSE

# --- ssh-agent ---
# If this shell is interactive, restart it within an ssh-agent.  This
# depends on ssh-agent and ssh-add being on the user's default PATH, which
# should be the case if they're in /usr/bin where they should be.

case $- in *i*)
  if [ "$SSH_AUTH_SOCK" == "" ] ; then
    exec ssh-agent $SHELL -l$- $*
  fi
  case "`ssh-add -l`" in "The agent has no identities."*)
    for i in identity id_rsa ; do if [ -r .ssh/$i ] ; then
      ssh-add .ssh/$i
    fi ; done
  esac
esac
# --- end ssh-agent ---
