From 50f9c72e41ee3f47f8ce79bf8b12a94038de8119 Mon Sep 17 00:00:00 2001 From: ttionya Date: Sun, 8 Nov 2020 14:28:44 +0800 Subject: [PATCH] feat: ask before restoration --- scripts/restore.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/restore.sh b/scripts/restore.sh index bf103d4..b99ed25 100644 --- a/scripts/restore.sh +++ b/scripts/restore.sh @@ -95,6 +95,8 @@ function restore_file() { } function restore() { + local READ_RESTORE_CONTINUE + while [[ $# -gt 0 ]]; do case "$1" in -p|--password) @@ -131,5 +133,9 @@ function restore() { mkdir -p ${DATA_DIR} - restore_file + color yellow "Restore will overwrite the existing files, continue? (y/N)" + read -p "(Default: n): " READ_RESTORE_CONTINUE + if [[ $(echo "${READ_RESTORE_CONTINUE:-n}" | tr [a-z] [A-Z]) == "Y" ]]; then + restore_file + fi }