diff --git a/handlers/borg.helper.in b/handlers/borg.helper.in index 19b3cce9fdb4d959f8e13550371ffefdf255c734..bb9dff96f378174fde4c6cae0314967e417c3863 100644 --- a/handlers/borg.helper.in +++ b/handlers/borg.helper.in @@ -133,23 +133,20 @@ do_borg_local_dir() { fi echo "Testing to see if the borg backup directory exists and is writable" - test -d $borg_directory - if [ $? = 0 ]; then - test -w $borg_directory - if [ $? != 0 ]; then + if [ test -d "$borg_directory" ]; then + if [ test -w "$borg_directory" ]; then msgBox "destination directory is not writable!" "The destination directory is not writable by the user you specified. Please fix the permissions on the directory and then try again." dir_status=failed fi else booleanBox "Destination does not exist" "The destination backup directory does not exist, do you want me to create it for you?" if [ $? = 0 ]; then - mkdir -p $borg_directory - result=$? - case $result in - 0) msgBox "$borg_title: success" "Creation of the destination directory was a success!";; - 1) msgBox "$borg_title: error" "Creation of the destination directory failed, check the directory permissions." - dir_status=failed;; - esac + if mkdir -p "$borg_directory"; then + msgBox "$borg_title: success" "Creation of the destination directory was a success!" + else + msgBox "$borg_title: error" "Creation of the destination directory failed, check the directory permissions." + dir_status=failed + fi fi fi