From 3198a02081f53d569b876bf316671c1f9b08ca67 Mon Sep 17 00:00:00 2001 From: AustrianToast Date: Sat, 13 Jul 2024 00:19:42 +0200 Subject: [PATCH] modify check --- update | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/update b/update index 328bfd1..37503a4 100755 --- a/update +++ b/update @@ -10,21 +10,20 @@ DATE="$(date +"%Y-%m-%dT%H:%M:%S%:z")" # RFC 3339 date-time https://datatracker source "$HOME"/.config/update.conf || exit 1 check_for_valid_backup_location() { - if [ $1 ]; then - if [ ! -d $1 ]; then - echo -e "${IYELLOW}$1 doesn't exist${NO_COLOR}" - read -p "Do you want to create the path and continue? [y/N]" input - case $input in - [Yy]) mkdir --parents "$1" ;; - [Nn]) exit 0;; - * ) exit 0 ;; - esac - fi + [[ $BACKUP_LOCATION ]] || echo -e "${IYELLOW}BACKUP_LOCATION has not been specified${NO_COLOR}" + if [ ! -d $1 ]; then + echo -e "${IYELLOW}$1 doesn't exist${NO_COLOR}" + read -p "Do you want to create the path and continue? [y/N]" input + case $input in + [Yy]) mkdir --parents "$1" ;; + [Nn]) exit 0;; + * ) exit 0 ;; + esac fi } check_for_valid_backup_location "$BACKUP_LOCATION" -check_for_valid_backup_location "$SECONDARY_BACKUP_LOCATION" +[[ $SECONDARY_BACKUP_LOCATION ]] && check_for_valid_backup_location "$SECONDARY_BACKUP_LOCATION" trap interrupt_function INT