From 0e63cfc1daf1c72683e5f8d548382c024986004c Mon Sep 17 00:00:00 2001 From: vinceliuice Date: Fri, 31 Mar 2023 22:44:19 +0800 Subject: [PATCH] Fixed #834 #835 #827 --- shell/lib-core.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/shell/lib-core.sh b/shell/lib-core.sh index 7080b506..79ef3f0d 100755 --- a/shell/lib-core.sh +++ b/shell/lib-core.sh @@ -636,6 +636,17 @@ restore_file() { } backup_file() { + if [[ -f "${1}.bak" || -d "${1}.bak" ]]; then + case "${2}" in + sudo) + sudo rm -rf "${1}" ;; + udo) + udo rm -rf "${1}" ;; + *) + rm -rf "${1}" ;; + esac + fi + if [[ -f "${1}" || -d "${1}" ]]; then case "${2}" in sudo) @@ -669,7 +680,7 @@ remind_relative_path() { sudo() { local result="0" - prompt -w "Executing '$(echo "${@}" | cut -c -35 )...' as root" + prompt -w "Executing '$(echo "${@}" | cut -c -35 )...' as root \n" if ! ${SUDO_BIN} -n true &> /dev/null; then echo -e "\n ${c_magenta} Authentication is required${c_default} ${c_green}(Please input your password):${c_default} \n"