I was playing around with md5sum and redirections and I got a weird outcome.
I created an empty file name f1, and got this as its md5sum: d41d8cd98f00b204e9800998ecf8427e f1
.
Then I used the command md5sum f1 > f1
, and as I expected it, when I use cat f1
, the same result appears on screen.
Keeping on, trying to set a loop, I then used md5sum f1
, and the result was 1e3c66dfc03fbebc883b4718bf1bb065 f1
(so I'm sure I'm not in a special case where f(x)=x).
So I then typed md5sum f1 > f1
, and when I used cat on the file, the content didn't change a bit (it was still d41d8cd98f00b204e9800998ecf8427e f1
and not 1e3c66dfc03fbebc883b4718bf1bb065 f1
as it should be). So I thought that I was missing something with feed redirection (I'd like to point I'm not trying to have successives sums in the file, but only the last one computed), so I tried echo foobar > f1
and cat f1
gave me the expected foobar
.
Do you have any idea why the new md5sum isn't in the file?
If this can help, I'm running Ubuntu version 18.04.4 and md5sum version 8.28
Thanks