From af291c07e0e9ee163807e9cd2a96935a65aed6b8 Mon Sep 17 00:00:00 2001 From: Patrick Van der Veken Date: Thu, 28 May 2020 17:37:34 +0200 Subject: [PATCH] Fixed bug in sftp_file(): when file does not contain a directory path, the $TRANSFER_DIR was wrongly calculated --- manage_sudo.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manage_sudo.sh b/manage_sudo.sh index c933bfc..ee98fdc 100644 --- a/manage_sudo.sh +++ b/manage_sudo.sh @@ -42,7 +42,7 @@ # or LOCAL_CONFIG_FILE instead # define the version (YYYY-MM-DD) -typeset -r SCRIPT_VERSION="2018-11-03" +typeset -r SCRIPT_VERSION="2020-05-28" # name of the global configuration file (script) typeset -r GLOBAL_CONFIG_FILE="manage_sudo.conf" # name of the local configuration file (script) @@ -1253,7 +1253,7 @@ typeset OLD_PWD="" typeset SFTP_RC=0 # find the local directory & permission bits -TRANSFER_DIR="${TRANSFER_FILE%/*}" +TRANSFER_DIR=$(dirname "${TRANSFER_FILE%%!*}") TRANSFER_PERMS="${TRANSFER_FILE##*!}" # cut out the permission bits and the directory path TRANSFER_FILE="${TRANSFER_FILE%!*}"