I know you can redirect the output of echo to a file using this syntax:

$ echo "Hello" > file.txt

But I recently discovered a different way of producing the same output as above which is:

$ echo > file.txt "Hello"

Can someone explain how this second command works? I have never seen this specific syntax before and I haven't found any docs on this too.

marked as duplicate by muru, Kusalananda bash Apr 8 at 9:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Browse other questions tagged or ask your own question.