Question
I’ve overwritten the gnome-screenshot program to suit my needs in getting a screenshot from a secondary home-made graphics card output and now when I press the PrintScreen button it executes it (as desired). However, there are some “printf” statements in the program (written in C) that I would like to be able to see as output. Is there any way to do this? Perhaps by spawning a terminal when the program executes?
Running: Red Hat Enterprise Linux Client release 5.8 (Tikanga)
Answer
The simplest way to capture the output would be to wrap your PrintScreen command in a shell and redirect the output to a file. For example, if your program is named myprscr
, the shell script might be:
#!/bin/sh
myprscr 2>1 1>>/tmp/myprscr.log
Then have the PrintScreen button run that shell script instead of the your command. You will probably want use the full path for myprscr
.
Check more discussion of this question.