Created
October 22, 2009 05:22
-
-
Save shaobin0604/215752 to your computer and use it in GitHub Desktop.
控制台生成进度条
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
#!/usr/bin/env ruby | |
# | |
# This script will generate a progress bar in console interface | |
# | |
0.upto(50) do |i| | |
printf("progress: [%-50s] %d%%\r", '#' * i, i * 2); | |
sleep(1) | |
end | |
puts | |
puts "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment