#!/bin/bash # variables BACKUP_PATH=/media/isabell/Elements\ SE/isabell_tuxedo/ NOBACKUP_FILE=.nobackup # backup execution if [[ -d "$BACKUP_PATH" ]] && echo "Starting rsync backup of home directory to $BACKUP_PATH"; then if [[ -f "$NOBACKUP_FILE" ]] && echo "Found $NOBACKUP_FILE file, proceeding? (y/n)"; then read PROCEEDING if [[ "$PROCEEDING" == "y" ]]; then rsync -av --delete --filter 'dir-merge,- $NOBACKUP_FILE' "$HOME/" "$BACKUP_PATH" fi else echo "No $NOBACKUP_FILE found, proceeding to back-up entire home directory? (y/n)" read PROCEEDING if [[ "$PROCEEDING" == "y" ]]; then rsync -av --delete "$HOME/" "$BACKUP_PATH" fi fi else echo "Device or location designated for the backup does not exist." fi