<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FCENTSOARER</id>
	<title>GRASS-Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FCENTSOARER"/>
	<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/wiki/Special:Contributions/%E2%9A%A0%EF%B8%8FCENTSOARER"/>
	<updated>2026-05-25T03:47:18Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Scripting&amp;diff=19078</id>
		<title>Scripting</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Scripting&amp;diff=19078"/>
		<updated>2013-07-02T22:33:50Z</updated>

		<summary type="html">&lt;p&gt;⚠️CENTSOARER: VEBOSE for VERBOSE&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Scripting ==&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
* See the {{cmd|g.parser}} module help page. It's an easy way to make your script look and act like a GRASS module, including creating a GUI and help page template for it automatically.&lt;br /&gt;
&lt;br /&gt;
* There are a number of other:{{cmd|general}} g.* modules which are specifically useful for scripting use.&lt;br /&gt;
&lt;br /&gt;
==== Verbosity level ====&lt;br /&gt;
&lt;br /&gt;
Use the &amp;quot;--quiet&amp;quot; (alias --q) and &amp;quot;--verbose&amp;quot; (alias --v) command line arguments to make the script produce more or less messages and info like percent done. This works for almost all modules. The big exception to that is {{cmd|r.mapcalc}} which doesn't use the standard parser in GRASS 6 (in GRASS 7 it does).&lt;br /&gt;
&lt;br /&gt;
In GRASS 6, for r.mapcalc, or if you want to set a blanket --quiet directive for the whole script, you can set the GRASS_VERBOSE environmental variable. Python's os module has a putenv() function to do that. &lt;br /&gt;
&lt;br /&gt;
These are the levels you can use:&lt;br /&gt;
  (from lib/gis/verbose.c)&lt;br /&gt;
 0 - module should print nothing but errors and warnings (G_fatal_error,&lt;br /&gt;
      G_warning)  Triggered by &amp;quot;--q&amp;quot; or &amp;quot;--quiet&amp;quot;.&lt;br /&gt;
 1 - module will print progress information (G_percent)&lt;br /&gt;
 2 - module will print all messages (G_message)  [default level]&lt;br /&gt;
 3 - module will be very verbose. Triggered by &amp;quot;--v&amp;quot; or &amp;quot;--verbose&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;--quiet&amp;quot; will set the level to 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
shell script example&lt;br /&gt;
 # for everything that follows&lt;br /&gt;
 GRASS_VERBOSE=1&lt;br /&gt;
 export GRASS_VERBOSE&lt;br /&gt;
&lt;br /&gt;
 # override for just one module&lt;br /&gt;
 GRASS_VERBOSE=0 \&lt;br /&gt;
   r.mapcalc &amp;quot;only_set = for_this_process&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another nice thing about using the environmental variable method is that it is silently ignored for earlier versions of GRASS. For earlier versions (&amp;lt;6.2.x) of GRASS an error happens when &amp;quot;--quiet&amp;quot; isn't recognized as a valid command line option.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
see &amp;quot;Verbosity levels&amp;quot; on the [[Development_Specs]] page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The advantage of these methods versus sending all stderr to /dev/null is that&lt;br /&gt;
warning and error messages are not lost, making prototyping and debugging a&lt;br /&gt;
whole lot easier.&lt;br /&gt;
&lt;br /&gt;
=== Shell scripts ===&lt;br /&gt;
&lt;br /&gt;
See the [http://grass.osgeo.org/grass64/source/snapshot/SUBMITTING_SCRIPTS SUBMITTING_SCRIPTS] file for some tips.&lt;br /&gt;
&lt;br /&gt;
See the existing GRASS scripts in the scripts/ directory for examples of using tempfiles, etc.&lt;br /&gt;
&lt;br /&gt;
Newer versions of Ubuntu use Dash as the default /bin/sh, so don't assume that sh will handle Bashisms.&lt;br /&gt;
&lt;br /&gt;
* [[GRASS_and_Shell|Running GRASS as a batch job]]&lt;br /&gt;
* [[Script_portability|Script portability]]&lt;br /&gt;
&lt;br /&gt;
=== Tcl/Tk ===&lt;br /&gt;
&lt;br /&gt;
See the [http://grass.osgeo.org/grass64/source/snapshot/SUBMITTING_TCLTK SUBMITTING_TCLTK] file for some tips.&lt;br /&gt;
&lt;br /&gt;
=== Python ===&lt;br /&gt;
&lt;br /&gt;
* See the [[GRASS and Python]] page&lt;br /&gt;
&lt;br /&gt;
{{Python}}&lt;/div&gt;</summary>
		<author><name>⚠️CENTSOARER</name></author>
	</entry>
</feed>