Hi all,

This one has turned out to be a bit of a tough nut to crack!
Essentially, here's what I want to do:

$ rsync --progress <some-file> ./ | awk '$0~/ /{sub(/%/,"");print $2;fflush()}' 
| zenity --progress

essentially what this does, is pipe the rsync output to awk, which
strips off the '$' and prints out only the percent number, then pipes
that to zenity, so that I can get a nice progress bar.

However, it doesn't work because there is some line buffering going on,
and because rsync doesn't print any newlines (instead it prints ^M, or
carriage return) during the stage where you see
    13139968  12%   11.36MB/s    0:00:08
so that it can keep going back to the beginning of the line to redraw
the progress.

So I tried to stop the line buffering by using stty
$ stty eol 0xd

which should make 0xd "end the line" according to `man stty` but it
didn't work.

I tried various other approaches, but to no avail.

When I run rsync by hand, it doesn't line buffer, but when pipe the
output to something, it does.

Is there any way around this?

Many thanks,
-- 
Iain Buchanan <iaindb at netspace dot net dot au>

>Ever heard of .cshrc?
That's a city in Bosnia.  Right?
(Discussion in comp.os.linux.misc on the intuitiveness of commands.)

-- 
gentoo-user@gentoo.org mailing list

Reply via email to