Last active
May 6, 2018 18:29
-
-
Save im-samir-dev/c245e478854172bbe04118a09e3cccf6 to your computer and use it in GitHub Desktop.
Python and Bash script progress counter sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
for i in range(0, 101): | |
sys.stdout.write("Progress: %d%% \r" % i) | |
sys.stdout.flush() | |
time.sleep(0.05) | |
pass | |
sys.stdout.write("\r\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import time | |
sys.stdout.write("Progress: ") | |
for i in range(0, 101): | |
sys.stdout.write("%d%%" % (i)) | |
sys.stdout.flush() | |
time.sleep(0.1) | |
for j in range(0, len(str(i)) + 1): | |
sys.stdout.write("\b") | |
pass | |
pass | |
sys.stdout.write("\r\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ((i=1; i<1024; i=i*2)); do | |
echo -en "\r \r$i" | |
sleep .5 | |
done | |
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ((i=0; i<101; i++)); do | |
echo -en "\r \r$i" | |
sleep .05 | |
done | |
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in {000..100..2}; do | |
echo -en "\r \r$i" | |
sleep .2 | |
done | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
joooon :)