From b017c00a6cb9cfe96be7239a8c63ef45268e6459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=A0tefka?= Date: Mon, 27 Feb 2023 00:57:15 +0100 Subject: [PATCH] Reload the script after --redownload --- msman.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/msman.sh b/msman.sh index 659cc22..2444d38 100755 --- a/msman.sh +++ b/msman.sh @@ -238,8 +238,11 @@ function self_update { # Make the file executable chmod +x msman_new.sh # Remove the old script - rm msman.sh + if [[ -f msman.sh ]]; then + echo "Removing old script..." + rm msman.sh echo "Removed old script" + fi # Rename the new script mv msman_new.sh msman.sh echo "Renamed new script" @@ -460,6 +463,9 @@ function main { if [[ "$1" == "--redownload" ]] || [[ "$1" == "-r" ]]; then get_latest_script_release self_update + # Reload the script + exec "$0" + exit 0 # TODO: Add `--edit-config` option elif [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]]; then echo "Usage: ./script.sh [OPTION]"