So I have a program lets call it foo.I am attempting to redirect its terminal output to a file using the following command.foo > ./someFile.txtNow when I run that command someFile.txt gets created however it is empty. Any suggestions on how I could redirect the terminal output?
Redirect output of a program to a file fails
io redirection
It is expected behavior, that a file someFile.txt will be created. Whether or not this file contains anything, depends on what your program foo is supposed to do.Whatever problem you are encountering, does not seem to be related to output redirection. You can try following command as a test:cat > someFile.txttype anything. Whatever you typed will be redirected to someFile.txt (end with ctrl+d).Bytheway, the output file is being created by your shell, not by your program foo. Even if you type a nonexistent command, the output file will still be created (empty):/bin/nonexistent > zzz