g.message.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <h2>DESCRIPTION</h2>
  2. <p>This program is to be used in shell/perl/python scripts, so the author does not
  3. need to use the <tt>echo</tt> program. The advantage of <em>g.message</em> is
  4. that it formats messages just like other GRASS modules do and that its
  5. functionality is influenced by the <tt>GRASS_VERBOSE</tt> and
  6. <tt>GRASS_MESSAGE_FORMAT</tt> environment variables.
  7. <p>The program can be used for standard informative messages as well as warnings
  8. (<b>-w</b> flag) and fatal errors (<b>-e</b> flag). For debugging
  9. purposes, the <b>-d</b> flag will cause <em>g.message</em> to print a debugging
  10. message at the given level.
  11. <h2>NOTES</h2>
  12. Messages containing "<tt>=</tt>" must use the full <b>message=</b> syntax so
  13. the parser doesn't get confused.
  14. <p>If you want a long message (multi-line) to be dealt with as a single
  15. paragraph, use a single call to <em>g.message</em> with text split in the
  16. script using the backslash as the last character. (In shell scripts don't
  17. close the "quote")
  18. <p>A blank line may be obtained with: <tt>g.message ""</tt>
  19. <p>Redundant whitespace will be stripped away.
  20. <p>It's advisable to single quote the messages that are to be printed literally.
  21. It prevents a number of characters (most notably, space and the dollar sign
  22. '<tt>$</tt>') from being treated specifically by the Shell.
  23. <p>When it is necessary to include, for example, a variable's value as part of
  24. the message, the double quotes may be used, which do not deprive the
  25. dollar sign of its special variable-expansion powers.
  26. <p>While it is known that the interactive Bash instances may treat the
  27. exclamation mark '<tt>!</tt>' character specifically (making single quoting
  28. of it necessary), it shouldn't be the case for the non-interactive
  29. instances of Bash. None the less, to avoid context-based confusion later on
  30. you are enouraged to single-quote messages that do not require
  31. <tt>$VARIABLE</tt> expansion.
  32. <p>
  33. <h3>VERBOSITY LEVELS</h3>
  34. Controlled by the "<tt>GRASS_VERBOSE</tt>" environment variable. Typically this
  35. is set using the <tt>--quiet</tt> or <tt>--verbose</tt> command line options.
  36. <ul>
  37. <li>0 - only errors and warnings are printed
  38. <li>1 - progress messages are printed
  39. <li>2 - all module messages are printed
  40. <li>3 - additional verbose messages are printed
  41. </ul>
  42. <h3>DEBUG LEVELS</h3>
  43. Controlled by the "<tt>DEBUG</tt>" GRASS <i>gisenv</i> variable. (set with
  44. <em><a href="g.gisenv.html">g.gisenv</a></em>)
  45. <br>
  46. Recommended levels:
  47. <ul>
  48. <li>1 - message is printed once or few times per module
  49. <li>3 - each row (raster) or line (vector)
  50. <li>5 - each cell (raster) or point (vector)
  51. </ul>
  52. <h2>SEE ALSO</h2>
  53. <em>
  54. <a href="variables.html">GRASS variables and environment variables</a>,<br>
  55. <a href="g.gisenv.html">g.gisenv</a>,
  56. <a href="g.parser.html">g.parser</a>
  57. </em>
  58. <h2>AUTHOR</h2>
  59. Jachym Cepicky
  60. <p><i>Last changed: $Date$</i>