Skip to content

Instantly share code, notes, and snippets.

@shaobin0604
Created October 22, 2009 05:22
Show Gist options
  • Save shaobin0604/215752 to your computer and use it in GitHub Desktop.
Save shaobin0604/215752 to your computer and use it in GitHub Desktop.
控制台生成进度条
#!/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