mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-02-25 05:57:26 +00:00
Add tail -1 before tr to use only the last value
This commit is contained in:
committed by
Michel Roegl-Brunner
parent
622fda4b32
commit
75898f4986
@@ -201,10 +201,10 @@ download_with_progress() {
|
||||
|
||||
content_length=$(
|
||||
curl -fsSLI "$url" 2>/dev/null |
|
||||
# May return multiple values on redirect. i.e., 0 and content-length
|
||||
# May return multiple values on redirect. i.e., 0 and actual content-length value
|
||||
# Cast $2 to int by adding 0 to it
|
||||
awk '(tolower($1) ~ /^content-length:/) && ($2 + 0 > 0) {print $2+0}' |
|
||||
tr -cd '[:digit:]' || true
|
||||
tail -1 | tr -cd '[:digit:]' || true
|
||||
)
|
||||
|
||||
if [ -n "$content_length" ]; then
|
||||
|
||||
Reference in New Issue
Block a user