<off-topic>
On 7 Mrz., 10:32, Tomasz Chmielewski <t...@[EMAIL PROTECTED]
>
wrote:
> Consider a following shell code executed in bash:
>
> $ while true; do date; sleep 1; done | awk '{print $4}'
> 10:23:19
> 10:23:20
> 10:23:21
> 10:23:22
> 10:23:23
> [ctrl+c]
>
> It prints something to the standard output.
>
> Now, let's use the same commands, but instead, redirect the output to a
> file:
>
> $ while true; do date; sleep 1; done | awk '{print $4}' > out.txt
>
> [wait a minute here, and press ctrl+c]
>
> "out.txt" file is empty, nothing was printed to the screen. Where did
> the output redirection go?
In an I/O buffer that hasn't got filled enough to be flushed
before you aborted the process.
To understand, try...
while true; do date; sleep 1; done | head -3 | awk '{print $4}' >
out.txt
(BTW, this is off-topic here; comp.unix.shell is more appropriate.)
Janis
>
> --
> Tomasz Chmielewskihttp://wpkg.org


|