Bash: read stdin from file and write stdout to file

Let’s forget about top, that appears to be a red herring.

To map stdin or stdout to files, you can use redirection:

some_program < input_file          # Redirects stdin

another_program > output_file      # Redirects stdout

or even:

yet_another  < input_file > output_file

Leave a Comment