Bash: read stdin from file and write stdout to file
bash, linux
Solution
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
Problem
I'm trying to run an app (let's say `top`) so it will read from a file for stdin and write to another file from stdout. Currently I have ``` mkfifo stdin.pipe (tail -f stdin.pipe) | top ``` which works as expected, as I can then `echo` something to that file and top will receive it. But I'm unable to redirect the output of top. How can I achieve this? EDIT: Ok, let's scratch top. I'm testing with this: ``` cat test.sh echo Say something read something echo you said $something ```