From 5a93fe6b470ea35c449397977b7bfd7ccf481b5c Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Sun, 24 Apr 2022 21:07:18 +0200 Subject: [PATCH] sync.sh: Minor changes --- bash/sync.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bash/sync.sh b/bash/sync.sh index a6a2472..1a8b29f 100755 --- a/bash/sync.sh +++ b/bash/sync.sh @@ -162,10 +162,10 @@ function aftersync () { # Some variables were moved into the code (example: in the log() function), # for practical reasons, the absence of associative arrays being one of them. LOCKED=n # indicates if we created lock file. -SUBJECT="${0##*/} ${*##*/}" # mail subject (removes paths) +CMDNAME=${0##*/} # script name +SUBJECT="$CMDNAME ${*##*/}" # mail subject ERROR=0 # set by error_handler when called STARTTIME=$(date +%s) # time since epoch in seconds -CMDNAME=${0##*/} usage () { printf "usage: %s [-ymwdnfrzuDZ] config-file\n" "$CMDNAME" @@ -196,8 +196,8 @@ done shift $((OPTIND - 1)) (( $# != 1 )) && usage CONFIG="$1" -if [[ ! -f "$CONFIG" ]]; then - echo "No $CONFIG file." +if [[ ! -r "$CONFIG" ]]; then + printf "%s: Canot open $CONFIG file. Exiting." usage fi # shellcheck source=/dev/null