Today I'm learning sort command.
I find that, I can use
sort file1 > file2
To inject the sorted file into file2
But when I use
sort file1 > file1
file1 become empty!
I know I can use -o flag to get the sort file1 into file1.
But why the second command produce an empty file?