Error in download() bug resolved
This commit is contained in:
parent
e2f41eb862
commit
3b91eda6db
1 changed files with 7 additions and 4 deletions
11
init.sh
11
init.sh
|
@ -124,11 +124,14 @@ download (){
|
|||
# $2 : url
|
||||
# $3 : 1 if abort download if file exist
|
||||
printf "Downloading %s : " "$1"
|
||||
http_response=$(wget --spider --server-response $2/$1 2>&1 | grep HTTP/ | tail -1 | awk ' { printf $2 }')
|
||||
if [ $http_response -eq 200 ]
|
||||
local url
|
||||
local http_response
|
||||
url="$2/$1"
|
||||
http_response=$(wget --spider --server-response "$url" 2>&1 | grep HTTP/ | tail -1 | awk ' { printf $2 }')
|
||||
if [ "$http_response" -eq 200 ]
|
||||
then
|
||||
wget -c --progress=dot $2/$1 2>&1 | grep --line-buffered "[0-9]\{1,3\}%" -o | awk '{printf ("\b\b\b\b%4s", $1)}'
|
||||
if [ $? -eq 0 ]
|
||||
wget -c --progress=dot "$url" 2>&1 | grep --line-buffered "[0-9]\{1,3\}%" -o | awk '{printf ("\b\b\b\b%4s", $1)}'
|
||||
if [ "$?" -eq 0 ]
|
||||
then
|
||||
printf " \b\b\b\b\b done\n "
|
||||
else
|
||||
|
|
Reference in a new issue