When I run a third parties program from the command line (this program basically list's a whole load of stuff) and write the output to a file it splits the output, i.e. in the middle of the file appears the exit command.
If I don't redirect the output and write it to tty then the output is continous without the word exit.
How can I get it to replicate what is written to screen into a file?
I have exhausted what I know!
in /etc/profile or .profile or .bashrc or whatever do find a line
that looks like this? Some trap statement?
trap "echo 'exit' " 0
Try somecommand | tee output_file which will write the output of the command to the output_file and the screen simultaneously - that way both outputs should be idenitical - not a solution, but an "investigatory" step....
Cheers
ZB
http://www.zazzybob.com
Use the tee -a flag to append your output to a file. You can also redirect both standard out (STDOUT) and standard error (STDERR) streams to a file using their respective file descriptors.
Example:
command > file 2>&1
or to append to the file:
command >> file 2>&1