g.message

Langue: en

Autres versions - même langue

Version: 370331 (fedora - 01/12/10)

Section: 1 (Commandes utilisateur)

NAME

g.message - Prints a message, warning, or fatal error the GRASS way.
This module should be used in scripts for messages served to user.

KEYWORDS

general

SYNOPSIS

g.message
g.message help
g.message [-wediv] message=string [debug=integer] [--verbose] [--quiet]

Flags:

-w

Print message as GRASS warning
-e

Print message as GRASS fatal error
-d

Print message as GRASS debug message
-i

Print message in all but full quiet mode
-v

Print message only if in verbose mode
--verbose

Verbose module output
--quiet

Quiet module output

Parameters:

message=string

Text of the message to be printed
debug=integer

Level to use for debug messages
Options: 0-5
Default: 1

DESCRIPTION

This program is to be used in shell/perl/python scripts, so the author does not need to use the echo program. The advantage of g.message is that it formats messages just like other GRASS modules do and that its functionality is influenced by the GRASS_VERBOSE and GRASS_MESSAGE_FORMAT environment variables.

The program can be used for standard informative messages as well as warnings (-w flag) and fatal errors (-e flag). For debugging purposes, the -d flag will cause g.message to print a debugging message at the given level.

NOTES

Messages containing "=" must use the full message= syntax so the parser doesn't get confused.

Messges containing '!' and '$' must use single 'quotes' to avoid unwanted shell translation.

If you want a long message (mutli-line) to be dealt with as a single paragraph, use a single call to g.message with text split in the script using the backslash as the last character. (In shell scripts don't close the "quote")

A blank line may be obtained with: g.message ""

Redundant whitespace will be stripped away.

VERBOSITY LEVELS

Controlled by the "GRASS_VERBOSE" environment variable. Typically this is set using the --quiet or --verbose command line options.
0 - only errors and warnings are printed
1 - progress messages are printed
2 - all module messages are printed
3 - additional verbose messages are printed

DEBUG LEVELS

Controlled by the "DEBUG" GRASS gisenv variable. (set with g.gisenv)
Recommended levels:
1 - message is printed once or few times per module
3 - each row (raster) or line (vector)
5 - each cell (raster) or point (vector)

SEE ALSO

GRASS variables and environment variables,
g.gisenv, g.parser

AUTHOR

Jachym Cepicky

Last changed: $Date: 2007-05-30 05:42:20 +0200 (Wed, 30 May 2007) $

Full index

© 2003-2008 GRASS Development Team