diff options
Diffstat (limited to 'scripts/lib_backup.sh')
| -rw-r--r-- | scripts/lib_backup.sh | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/scripts/lib_backup.sh b/scripts/lib_backup.sh index 6867fb6d..b6f54f6a 100644 --- a/scripts/lib_backup.sh +++ b/scripts/lib_backup.sh @@ -1,9 +1,21 @@ #!/usr/bin/env bash +# ================================================== +# KoolDots (2026) +# Project URL: https://github.com/LinuxBeginnings +# License: GNU GPLv3 +# SPDX-License-Identifier: GPL-3.0-or-later +# ================================================== # Backup helper utilities shared by copy.sh (and future scripts). # Create a unique backup directory name with month, day, hours, and minutes. get_backup_dirname() { - echo "back-up_$(date +"%m%d_%H%M")" + if [ -n "${BACKUP_DIR:-}" ]; then + echo "$BACKUP_DIR" + return + fi + BACKUP_DIR="back-up_$(date +"%m%d_%H%M")" + export BACKUP_DIR + echo "$BACKUP_DIR" } # Move a directory to a timestamped backup alongside the original. |
