[linux-audio-user] A dumb Unix question about console output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 &



That is:

[command and options here]  2>  log_filename_here

The ampersand will send the command to the background.

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.

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.

I hope this will help you.
GZS


Larry Troxler wrote:
> Hi,
> 
> I hesitate to ask this here, since it's gotta be a basic shell thing, and 
> certainly not audio specific, so if you want to flame me for me OT and 
> laziness, go ahead.
> 
> The problem is that when I run I run an X application from a console (for 
> example, "pd &" or "rosegarden &", the console output from all the 
> applications I run are interleaved onto the xterm that I started them from.
> 
> That part is fine.
> 
> The part that is not fine, is that the output is not labeled with the 
> application that it came from.
> 
> For example, I seem to remember that if in the past, if you ran grep, for 
> example, anything that grep sent to its console would be prefixed by "grep:". 
> I thought that this was a convention that the apps followed, and not a shell 
> thing (I seem to remember "printf("%s: ...", argv[0], ....")
> 
> Hopefully, I'm wrong about this, and there is a shell option that puts the 
> application name in front of every line of output. Is there?
> 
> If it's not something I can make happen in the shell, then how is everyone 
> dealing with this? Currently I am actually opening a seperate xterm for each 
> X application that I run, which is quite cumbersome, because it means that I 
> have to manage twice minus one as many windows as I would if I could have all 
> the output into one xterm, identified with where it came from.
> 
> Looking forward to any ideas and any pointers to my misconceptions.
> 
> Larry Troxler
> 
> 
> 
> 
> 
> 

-- 
This Message is sent from my Red Hat 8.0 Linux server

       .-.
     .-. |                    Gustavo Zamorano S.




[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux