3 ms·
I don't understand this article. Saying "Replacing the contents of a file on the UNIX command line using the standard cp/mv commands is surprisingly tricky" is
by nathanb 17y ago
I don't understand this article. Saying "Replacing the contents of a file on the UNIX command line using the standard cp/mv commands is surprisingly tricky" is like saying "driving a car using only your ass is surprisingly tricky". That's true, but when there are standard, simple, non-tricky ways to do it then you're really just limiting yourself.
But hey, I'll play along. Won't this work:
cp file /dev/stdout > file
- sp332 17y ago>I don't understand this article.... cp file /dev/stdout > file Clearly, since this is point 1 in TFA. file is truncated before it is read, leaving you with a 0-length file.