My question is , if i am overwriting the contents thaen i should see the overwritten contens . Why the file is becoming blank . I know that cat file1 > file2 will do the job
I want to know the logic behind this using concept of input and output streams
The reason is simple: before cat is executed, the shell opens file1, and truncates it. Then cat opens file1 for reading, but it won't find any content as that's already gone.