Kiran Jadhav
Kiran Jadhav

Reputation: 11

How do I get the output of executable without using "write" command?

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

Answers (1)

Christian Fritz
Christian Fritz

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

Related Questions