[GRASSLIST:875] Re: how to suppress shell output ???
Glynn Clements
glynn.clements at virgin.net
Thu Jul 31 10:28:35 EDT 2003
Massimiliano Cannata wrote:
> How can I suppress shell std output using G_system()?
> maybe ...
> G_system("r.mapcalc >> temp.txt")
> .... but it doesn't seems to me to be enough just redirect it.
The above appends stdout to the file, but it leaves stderr untouched
(i.e. it's probably going to the terminal). Try:
G_system("r.mapcalc >> temp.txt 2>&1");
There are many possibilities for setting up the standard descriptors;
they will be described in the manpage for the shell, e.g. bash.
Although, if you want portability, and have "ash" installed, refer to
the manpage for ash rather than the one for bash, as bash has many
extensions which don't work with other shells.
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-user
mailing list