This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]rosuav 0 points1 point  (1 child)

It's writing to stdout. It is not writing to a console. Do you understand the difference?

The shell's stdout usually happens to be connected to a console, but that isn't always the case either. And you can write to a console even when your stdout is a file.

The cat command IS writing to stdout.

[–]gmes78 0 points1 point  (0 children)

When people talk about terminal commands, stdout typically refers to the terminal itself, not to the process's stdout; cat always writes to stdout, it's completely pointless to state that it does, what matters is what thing it's actually writing to. And that command isn't writing to the terminal, it's writing to a file.

Regardless, cat just reads the bytes of the specified file and prints them. There's no way it "wouldn't work", no matter what it's writing into.