redirecting stderr

GRASS 4.0 grass at
Wed Sep 14 11:55:20 EDT 1994

> From grass-lists-owner at Tue Aug 30 13:39:47 1994
> From: sue at (Susan Huse)
> Subject: redirecting stderr
> Sender: grass-lists-owner at
> Reply-To: grassp-list at
> To: grassp-list at
> Date: Tue, 30 Aug 1994 11:47:59 -0700 (PDT)
> X-Mailer: ELM [version 2.4 PL23]
> Content-Type> : > text> 
> Content-Length: 900
> I am trying to write a tcltk script that finds the nearest site
> and displays in a tk text widget stored text associated with the
> site.
> I want to use d.where as coordinate input to the script, but I'm
> having a difficult time redirecting the stderr.  It seems that

have yout tried piping the output through sed?

> stdout is just the coordinate pairs, which I want.  The stderr
> includes the mouse button instructions, etc.  Tcltk chokes on
> the stderr, thinking that in fact there has been an error.

some of the GRASS commands exit with a non zero status...
TCL picks this up as an error and directs the output into
an error message.

You may have to run this in a shellscript that sets the exit
status to zero when done.

> How do I redirect stderr to /dev/null or somewhere else.  It seems
> that d.where (and d.what.rast) don't understand "2>".
> I get a usage error statement telling that 2 is not a valid spheroid
> parameter.  I would be willing to use a pipe that directed only
> stderr, but don't know how to do that.  I don't want to use "|&"
> because then I either lose my stdout or I get the button commands,
> etc. mingled in with my coordinates.
> Sue Huse
> UC Berkeley
Keith Mitchell
University of Illinois
Dept. Of Ag. Engineering
Urbana, Illinois

More information about the grass-dev mailing list