LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   to collect logs from xterm window. (https://www.linuxquestions.org/questions/linux-newbie-8/to-collect-logs-from-xterm-window-641885/)

ponezhil 05-13-2008 09:49 AM

to collect logs from xterm window.
 
Hi all,

I am running a bash script on xterm wimdow. Now
i need to collect the logs from the xterm window.

my script

{
system ("xterm $bash_script");
.....
.....
}

Now I need to put the contents on xterm to a log file.

Please let me know how to redirect xterm contents to a log file.

regards,
Ezhil

theNbomr 05-13-2008 10:03 AM

Is your code fragment a piece of C code? If yes, then you can use popen() instead of system, and read back from the child process. The stuff you read back can then be written to a file of your choice.
man popen
If you want to do the work at a higher level, you could run a screen session in the xterm, and use its logging capabilities to capture the output of your script.
--- rod.


All times are GMT -5. The time now is 05:55 PM.