From f8dd301eeb34c160e852fc73323c4302e866b356 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:52:04 +0100 Subject: [PATCH] Improve --redownload Refactor junk code --- msman.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/msman.sh b/msman.sh index 31ce73e..52b2f64 100755 --- a/msman.sh +++ b/msman.sh @@ -236,11 +236,7 @@ function self_update { # Download the latest version of the script echo "Updating script..." # Download the file into msman_new.sh - curl -sLJ -w '%{http_code}\n' "https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_SCRIPT_VERSION/msman.sh" > msman_new.sh - # Check if the download was successful by checking the last line of the file for 200 - if [[ $(cat msman_new.sh | tail -n 1) == 200 ]]; then - # Remove the last line of the file - sed -i '$d' msman_new.sh + if [[ $(curl -sLJ -w '%{http_code}\n' "https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_SCRIPT_VERSION/msman.sh" -o msman_new.sh) == 200 ]]; then # Make the file executable chmod +x msman_new.sh # Remove the old script