1 |
Hi all, |
2 |
|
3 |
This one has turned out to be a bit of a tough nut to crack! |
4 |
Essentially, here's what I want to do: |
5 |
|
6 |
$ rsync --progress <some-file> ./ | awk '$0~/ /{sub(/%/,"");print $2;fflush()}' | zenity --progress |
7 |
|
8 |
essentially what this does, is pipe the rsync output to awk, which |
9 |
strips off the '$' and prints out only the percent number, then pipes |
10 |
that to zenity, so that I can get a nice progress bar. |
11 |
|
12 |
However, it doesn't work because there is some line buffering going on, |
13 |
and because rsync doesn't print any newlines (instead it prints ^M, or |
14 |
carriage return) during the stage where you see |
15 |
13139968 12% 11.36MB/s 0:00:08 |
16 |
so that it can keep going back to the beginning of the line to redraw |
17 |
the progress. |
18 |
|
19 |
So I tried to stop the line buffering by using stty |
20 |
$ stty eol 0xd |
21 |
|
22 |
which should make 0xd "end the line" according to `man stty` but it |
23 |
didn't work. |
24 |
|
25 |
I tried various other approaches, but to no avail. |
26 |
|
27 |
When I run rsync by hand, it doesn't line buffer, but when pipe the |
28 |
output to something, it does. |
29 |
|
30 |
Is there any way around this? |
31 |
|
32 |
Many thanks, |
33 |
-- |
34 |
Iain Buchanan <iaindb at netspace dot net dot au> |
35 |
|
36 |
>Ever heard of .cshrc? |
37 |
That's a city in Bosnia. Right? |
38 |
(Discussion in comp.os.linux.misc on the intuitiveness of commands.) |
39 |
|
40 |
-- |
41 |
gentoo-user@g.o mailing list |