Let's have the following code (here in python):
print("something\r any")
When running it in a console, this correctly produce:
anything
(after printing something
, the caret returns back to the beginning of the same line, and then overwrite the first four characters with any
)
However, the same command in a redirection will produce:
something
any
which is incorrect. Why is it so ? Is there something to tell the shell to rewrite the current line when redirecting ?
About the definition of CR and LF: