When I do this
the outfile should slowly grow along with the produced output. And with
However, when I now do
in order to read the produced output, that
I am quite sure that behaviour was not the case from the beginning, and I would very much like to get rid of it.
Specifically my usecase was that I wanted to watch a movie, and my movie collection is on NFS. When I'm on travel, that NFS gets routed via VPN, and -depending on location- it can become quite slow, too slow to get a synchronized playback even when the throughput itself might still cope with playback speed.
So I thought I could copy the movie to local storage, and watch whlle copying. Didn't work because of the beforementioned: while
°°°°°°°°°°°°°°°°°°°
Finally, doing the Randal Schwartz classic (useless use of cat) seems to solve the issue:
So this was quite certainly not here from the beginning, because then it would have been mentioned back there as a useful use of cat.
cmd > outfile &
the outfile should slowly grow along with the produced output. And with
ls -l
I can observe that growth.However, when I now do
cat outfile
in order to read the produced output, that
cat
will block with 0 bytes output, until cmd has terminated, and only then will produce the entire output.I am quite sure that behaviour was not the case from the beginning, and I would very much like to get rid of it.
Specifically my usecase was that I wanted to watch a movie, and my movie collection is on NFS. When I'm on travel, that NFS gets routed via VPN, and -depending on location- it can become quite slow, too slow to get a synchronized playback even when the throughput itself might still cope with playback speed.
So I thought I could copy the movie to local storage, and watch whlle copying. Didn't work because of the beforementioned: while
cp
copies the file, the outfile is locked against read. I thought the problem is somehow with NFS, and so, instead of doing cp /remoteshare/file /local/file
, I tried to do cat /remoteshare/file > /local/file
which should be independent of what gets fed to that stdout. But that also doesn't work: /local/file is locked against read until not written anymore.°°°°°°°°°°°°°°°°°°°
Finally, doing the Randal Schwartz classic (useless use of cat) seems to solve the issue:
cat /remoteshare/file | cat > /local/file
So this was quite certainly not here from the beginning, because then it would have been mentioned back there as a useful use of cat.