diff --git a/bin/rbucmd.sh b/bin/rbucmd.sh index 2ee1e5f..e94297c 100644 --- a/bin/rbucmd.sh +++ b/bin/rbucmd.sh @@ -32,7 +32,7 @@ while getopts cl: flag; do *) usage esac done -shift $((OPTIND - 1)) +shift $(($OPTIND - 1)) if [ $# -ne 2 ] || [ -z "$1" ] || [ -z "$2" ]; then usage fi @@ -41,8 +41,10 @@ backup_name=$2 [ -f "$host/bulist" ] || err "no bulist present in \"$h/\"" -eval $(ssh-agent -s) -trap 'eval $(ssh-agent -ks)' EXIT INT QUIT TERM +if [ -z "$SSH_AUTH_SOCK" ] || [ ! -S "$SSH_AUTH_SOCK" ]; then + eval $(ssh-agent -s) + trap 'eval $(ssh-agent -ks)' EXIT INT QUIT TERM +fi set -e