Skip to content

Commit 6a7257b

Browse files
committed
Ran shellcheck against raspiBackupOnlineVersions.sh
1 parent 57e2718 commit 6a7257b

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

scripts/raspiBackupOnlineVersions.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99
#######################################################################################################################
1010
#
11-
# Copyright (c) 2021-2023 framp at linux-tips-and-tricks dot de
11+
# Copyright (c) 2021-2025 framp at linux-tips-and-tricks dot de
1212
#
1313
# This program is free software: you can redistribute it and/or modify
1414
# it under the terms of the GNU General Public License as published by
@@ -25,12 +25,14 @@
2525
#
2626
#######################################################################################################################
2727

28+
#shellcheck disable=SC2034,SC2154
29+
# (warning): Date is referenced but not assigned (did you mean 'DATE'?).
30+
# (warning): GIT_DATE appears unused. Verify use (or export if used externally).
2831
GIT_DATE="$Date$"
29-
GIT_DATE_ONLY=${GIT_DATE/: /}
30-
GIT_DATE_ONLY=$(cut -f 2 -d ' ' <<< $GIT_DATE)
31-
GIT_TIME_ONLY=$(cut -f 3 -d ' ' <<< $GIT_DATE)
32+
#shellcheck disable=SC2034,SC2154
33+
# (warning): Sha1 is referenced but not assigned (did you mean 'DATE'?).
34+
# (warning): GIT_COMMIT appears unused. Verify use (or export if used externally).
3235
GIT_COMMIT="$Sha1$"
33-
GIT_COMMIT_ONLY=$(cut -f 2 -d ' ' <<< $GIT_COMMIT | sed 's/\$//')
3436

3537
MYHOMEDOMAIN="www.linux-tips-and-tricks.de"
3638
MYHOMEURL="https://$MYHOMEDOMAIN"
@@ -53,17 +55,19 @@ DATE="$(base64 -d <<< "$DATE")"
5355

5456
function analyze() { # fileName url
5557
tmp=$(mktemp)
56-
wget $2 -q --tries=$DOWNLOAD_RETRIES --timeout=$DOWNLOAD_TIMEOUT -O $tmp
58+
wget "$2" -q --tries="$DOWNLOAD_RETRIES" --timeout="$DOWNLOAD_TIMEOUT" -O "$tmp"
5759

5860
# GIT_COMMIT="$Sha1$"
5961
sha="$(grep "^GIT_COMMIT=" "$tmp" | cut -f 2 -d ' '| sed -e "s/[\$\"\']//g")"
6062
if [[ -z "$sha" ]]; then
6163
sha="$(grep "GIT_COMMIT=" "$tmp" | cut -f 3-4 -d ' ' )"
6264
fi
6365
if [[ -z "$sha" ]]; then
64-
sha="$(grep "$SHA" $tmp | cut -f 3-4 -d ' ' )"
66+
sha="$(grep "$SHA" "$tmp" | cut -f 3-4 -d ' ' )"
6567
fi
6668

69+
#shellcheck disable=SC2001
70+
#(style): See if you can use ${variable//search/replace} instead.
6771
sha="$(sed -e "s/[\$\"]//g" <<< "$sha")"
6872

6973
# VERSION="0.6.5-beta" # -beta, -hotfix or -dev suffixes possible
@@ -78,7 +82,7 @@ function analyze() { # fileName url
7882
date="$(grep "GIT_DATE=" "$tmp" | cut -f 3-4 -d ' ' )"
7983
fi
8084
if [[ -z "$date" ]]; then
81-
date="$(grep "$DATE" $tmp | cut -f 3-4 -d ' ' )"
85+
date="$(grep "$DATE" "$tmp" | cut -f 3-4 -d ' ' )"
8286
fi
8387

8488
[[ -z "$version" ]] && version="N/A"
@@ -87,7 +91,7 @@ function analyze() { # fileName url
8791

8892

8993
printf "%-30s: Version: %-10s Date: %-20s Sha: %-10s\n" "$1" "$version" "$date" "$sha"
90-
rm $tmp
94+
rm "$tmp"
9195
}
9296

9397
analyze "raspiBackup" $DOWNLOAD_URL

0 commit comments

Comments
 (0)