flavy69
|
2012-11-09
, 20:38
|
Posts: 103 |
Thanked: 21 times |
Joined on Sep 2012
@ romania
|
#4581
|
|
2012-11-09
, 20:40
|
Posts: 103 |
Thanked: 21 times |
Joined on Sep 2012
@ romania
|
#4582
|
|
2012-11-10
, 14:25
|
Posts: 299 |
Thanked: 557 times |
Joined on Aug 2012
|
#4583
|
#!/bin/bash bar="=============================================" barlength=${#bar} URL="https://dl.dropbox.com/u/17706605/N9_QuickTweak_en_v9.4.pdf" FILE=$(basename $URL) rm -f $FILE length=$(curl --head $URL 2>&1 | grep Content-Length | awk '{print $2}' | sed 's/.$//') wget $URL 2>/dev/null & while [ ! -f $FILE ] ; do sleep 0.1 done i=1 while [[ $i -lt $length ]]; do i=$(stat "$FILE" | grep Size | awk '{print $2}') n=$(($i * $barlength / $length)) printf "\r[%-${barlength}s]" "${bar:0:n}" sleep 0.2 done echo ""
The Following 3 Users Say Thank You to brkn For This Useful Post: | ||
|
2012-11-10
, 19:56
|
|
Posts: 5,339 |
Thanked: 4,133 times |
Joined on Jan 2010
@ Israel
|
#4584
|
WAIT! Downloading PDF instruction... /opt/N9QTweak/Tweaks/downloader.sh: line 24: Illegal number: n
|
2012-11-10
, 21:11
|
Posts: 299 |
Thanked: 557 times |
Joined on Aug 2012
|
#4585
|
|
2012-11-10
, 23:01
|
|
Posts: 5,339 |
Thanked: 4,133 times |
Joined on Jan 2010
@ Israel
|
#4586
|
I can only guess what goes wrong here. Are you executing the script with "sh script.sh"? You need to run it with "bash script.sh"!!
download() { local url=$1 echo -n " " wget --progress=dot $url 2>&1 | /opt/N9QTweak/SYS/bin/grep --line-buffered "%" | \ /opt/N9QTweak/SYS/bin/sed -u -e "s,\.,,g" | awk '{printf("\b\b\b\b%4s", $2)}' echo -ne "\b\b\b\b" echo " DONE" } file="http://dl.dropbox.com/u/17706605/N9_QuickTweak_en_v9.4.pdf" echo -n "Downloading status:" download "$file"
|
2012-11-11
, 00:29
|
Posts: 299 |
Thanked: 557 times |
Joined on Aug 2012
|
#4587
|
Ohhh.. You are right, sorry
It work but it show only bar...
Can we somehow combine it with your previous script where we can see the percentage status too ?:
Code:download() { local url=$1 echo -n " " wget --progress=dot $url 2>&1 | /opt/N9QTweak/SYS/bin/grep --line-buffered "%" | \ /opt/N9QTweak/SYS/bin/sed -u -e "s,\.,,g" | awk '{printf("\b\b\b\b%4s", $2)}' echo -ne "\b\b\b\b" echo " DONE" } file="http://dl.dropbox.com/u/17706605/N9_QuickTweak_en_v9.4.pdf" echo -n "Downloading status:" download "$file"
[===== ] 50%
[===== ] 50%
|
2012-11-11
, 01:40
|
|
Posts: 5,339 |
Thanked: 4,133 times |
Joined on Jan 2010
@ Israel
|
#4588
|
|
2012-11-11
, 02:57
|
Posts: 299 |
Thanked: 557 times |
Joined on Aug 2012
|
#4589
|
#!/bin/bash bar="========================================" barlength=${#bar} URL="https://dl.dropbox.com/u/17706605/N9_QuickTweak_en_v9.4.pdf" FILE=$(basename $URL) rm -f "$FILE" length=$(curl --head $URL 2>&1 | grep Content-Length | awk '{print $2}') wget -q $URL 2>/dev/null & while [ ! -f "$FILE" ] ; do sleep 0.1 done i=$(stat "$FILE" | grep Size | awk '{print $2}') while [[ $i -lt $length ]]; do i=$(stat "$FILE" | grep Size | awk '{print $2}') n=$(($i * $barlength / $length)) percent=$((100 * $i / $length)) printf "\r[%-${barlength}s]" "${bar:0:n}" printf " $percent%%" sleep 0.1 done printf "\n"
The Following 2 Users Say Thank You to brkn For This Useful Post: | ||
|
2012-11-11
, 05:45
|
|
Posts: 5,339 |
Thanked: 4,133 times |
Joined on Jan 2010
@ Israel
|
#4590
|
Tags |
hebrew vkb, n9 qtweak, n9 quick tweak, n9 quicktweak, root-ssh |
Thread Tools | |
|