tags:

views:

174

answers:

1

I am currently trying to add a progress bar to a command line script and I've tried various solutions (including Zend and Console_ProgressBar). The problem they both have in common is that the progress bar doesn't stick at the bottom of the window because during the script, new lines and other information is outputted.

Is there any way to keep the progress bar at the bottom of the terminal but still be able to output other information while the script is running?

[Edit]

I figured it out:

Instead of outputting directly to STDOUT I am actually grabbing the output inside a variable, I erase the screen with echo chr(27) . '[2J' and then output to STDOUT the contents of the variable and then append my progress bar.

Hope that makes sense :)

+1  A: 

There is probably a way using escape sequences.

Emil Ivanov
Thanks, I'll give it a go.
Andrei Serdeliuc
That's pretty much what I'm looking for, any way this can also work on windows?
Mark Tomlin