.TH g.message 1grass "" "GRASS 6.4.4" "Grass User's Manual" .SH NAME \fI\fBg.message\fR\fR - Prints a message, warning, progress info, or fatal error in the GRASS way. .br This module should be used in scripts for messages served to user. .SH KEYWORDS general, scripts .SH SYNOPSIS \fBg.message\fR .br \fBg.message help\fR .br \fBg.message\fR [\-\fBwedpiv\fR] \fBmessage\fR=\fIstring\fR [\fBdebug\fR=\fIinteger\fR] [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] .SS Flags: .IP "\fB\-w\fR" 4m .br Print message as warning .IP "\fB\-e\fR" 4m .br Print message as fatal error .IP "\fB\-d\fR" 4m .br Print message as debug message .IP "\fB\-p\fR" 4m .br Print message as progress info .IP "\fB\-i\fR" 4m .br Print message in all but full quiet mode .IP "\fB\-v\fR" 4m .br Print message only in verbose mode .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBmessage\fR=\fIstring\fR" 4m .br Text of the message to be printed .IP "\fBdebug\fR=\fIinteger\fR" 4m .br Level to use for debug messages .br Options: \fI0-5\fR .br Default: \fI1\fR .PP .SH DESCRIPTION .PP 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 \fIg.message\fR 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. .PP The program can be used for standard informative messages as well as warnings (\fB-w\fR flag) and fatal errors (\fB-e\fR flag). For debugging purposes, the \fB-d\fR flag will cause \fIg.message\fR to print a debugging message at the given level. .SH NOTES Messages containing "=" must use the full \fBmessage=\fR syntax so the parser doesn't get confused. .PP If you want a long message (multi-line) to be dealt with as a single paragraph, use a single call to \fIg.message\fR with text split in the script using the backslash as the last character. (In shell scripts don't close the "quote") .PP A blank line may be obtained with: g.message "" .PP Redundant whitespace will be stripped away. .PP It's advisable to single quote the messages that are to be printed literally. It prevents a number of characters (most notably, space and the dollar sign \(cq$') from being treated specifically by the Shell. .PP When it is necessary to include, for example, a variable's value as part of the message, the double quotes may be used, which do not deprive the dollar sign of its special variable-expansion powers. .PP While it is known that the interactive Bash instances may treat the exclamation mark '!' character specifically (making single quoting of it necessary), it shouldn't be the case for the non-interactive instances of Bash. None the less, to avoid context-based confusion later on you are enouraged to single-quote messages that do not require $VARIABLE expansion. .PP .SS VERBOSITY LEVELS Controlled by the "GRASS_VERBOSE" environment variable. Typically this is set using the \-\-quiet or \-\-verbose command line options. .RS .IP 0 - only errors and warnings are printed .IP 1 - progress messages are printed .IP 2 - all module messages are printed .IP 3 - additional verbose messages are printed .RE .SS DEBUG LEVELS Controlled by the "DEBUG" GRASS \fIgisenv\fR variable. (set with \fIg.gisenv\fR) .br Recommended levels: .RS .IP 1 - message is printed once or few times per module .IP 3 - each row (raster) or line (vector) .IP 5 - each cell (raster) or point (vector) .RE .SH SEE ALSO \fI GRASS variables and environment variables, .br g.gisenv, g.parser \fR .SH AUTHOR Jachym Cepicky .PP \fILast changed: $Date: 2011-11-08 12:29:50 +0100 (Tue, 08 Nov 2011) $\fR .PP Full index .PP © 2003-2014 GRASS Development Team