I'm using svn export
as part of a packager script for my application, and it looks like this command, like many others, doesn't have any kind of progress bar.
I have two choices at the moment:
- using it without options, and watch it printing thousands of lines
- using
--quiet
, and not seing anything until it completes.
Is there a way to at least show the number of lines output by the command, in real time? Such as:
Exporting SVN directory ... 1234 files
And see this number 1234
increment in real time? I can imagine piping the output to a command that would do just this, but which one?
Best Answer
Or put the bracketed section in a shell script. Note that this only works if your shell actually supports the preincrement operator, like bash or ksh93 or zsh. Otherwise you'll have to increment
$I
and then print it (as inI=$((I+1));printf...
). Also, ifprintf
isn't a builtin with your shell (it's a builtin with current bash), you could useecho -ne
orprint -n
instead for better performance. You just want to suppress the newline and have the \r interpreted as an escape character.