From: "Shot (Piotr Szotkowski)" Date: 2008-11-23T10:18:10+09:00 Subject: Printing right arrow vs. a sane progressbar library --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I want to track the progress of a set of (forkoff=E2=80=99d) processes in a simple way. What I have in mind is a line of dots equal in length to the number of processes, and once a process number X finishes, it prints \r, then advances X characters to the right and prints o =E2=80=93 so after three of eight processes finish, it could look like ..o.= =2Eoo. The closest I got is the below (in one line, so easily pastable to IRB): print '.' * 25; (0...25).sort_by{rand}.each { |n| print "\r"; print "\c[[C"= * n; print 'o'; sleep 0.5 }; print "\n" It seems to work in IRB and in a script (after $stdout.sync =3D true), unless the number of processes is larger than the terminal window=E2=80=99s width. Is this a sane method of doing what I want to do, or does it just =E2=80=98happens to work=E2=80=99 in GNOME Terminal on my Ubuntu? Is there a saner way to advance by a char than printing the right arrow? On a similar note: Is there a simple progressbar library for Ruby (ideally if itcan be somehow used with forkoff=E2=80=99d processes, but I= =E2=80=99m aware it=E2=80=99d require some kind of passing of state to the outside of = the block)? Is there anything else than Ruby/ProgressBar=C2=B9 (say, in a gem=E2=80=A6)? =C2=B9 http://0xcc.net/ruby-progressbar/ (I=E2=80=99m aware the above is prone to a race condition if two processes finish at the same time and the second one of them prints its \r before the first one prints its o, but let=E2=80=99s disregard this for now= =2E) -- Shot --=20 If I was to use Bugzilla when I was a tester, I'd quit and become a gardener. -- a Syllable OS developer --6TrnltStXW4iwmi0 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFJKLG4i/mCfdEo8UoRAi0hAJsENaZi10Twri1RNqmajg1ZH23VuwCdF4Dh O6ibFB/+kJ1rec3gUaDUl6o= =KXZc -----END PGP SIGNATURE----- --6TrnltStXW4iwmi0--