On Saturday 12 July 2003 21:43, Gustavo Zamorano S. wrote:
Larry:
Each process that is running has 3 devices:
Device 0: standard input: the keyboard
Device 1: standard output: the monitor
Device 2: standard error output : somehow goes to the monitor.
To trap error messages you need to redirect the standard error output
somewhere, for example:
printtool 2>/tmp/prt.log &
netscape 2>/tmp/net.log &
Well, it's not just the standard error, but the standard (console) output that
I'm interested in.
You can create a shell script with several lines and
run it from a link
to it on the desktop.
Then you can check the log files with cat, more, less, etc, etc.
Yeah, but I I don't need log files - it's enough for me to just see the output
of my programs in an xterm.
If you want to run several commands from one xterm
session, you can do
the following:
printtool 2>&1 | sed 's/^/printtool: /g' &
netscape 2>&1 | sed 's/^/netscape: /g' &
gimp 2>&1 | sed 's/^/gimp: /g' &
2>&1 means to redirect the standard error output to the standard output
( Device 2 to device 1).
Each error line will be preceded by the command name.
Well, yes, this would work, but it seems very brain-damaged. I mean, do people
really use this approach to keep their output seperate?
I find it hard to believe that this is the answer. I can't imagine that it's
common practice for everyone to pipe into sed every time they run an X
program.
Larry