Reputation: 11
I have a hello world code that is compiled. How do I get the output of the executable in a file instead of printing in the terminal where the program runs. Can it be done without including "write" command in code ?
The executable created is "hello.out" and compiled using "mpif90 hello.f90 -o hello.out"
Upvotes: 0
Views: 496
Reputation: 21364
./hello.out > filename
If you still want to see the output on the terminal as well you can pipe it to tee
instead:
./hello.out | tee filename
This will write the output to the file and to the terminal.
Upvotes: 1