Difference between revisions of "GRASS and Shell"

From GRASS-Wiki
Jump to navigation Jump to search
(made an own page)
 
(explanations added)
Line 1: Line 1:
You have to set a couple of variables:
You have to set a couple of variables:


<pre>
  # Example in bash shell syntax:
  # Example in bash shell syntax:
  export GISBASE=/usr/local/grass60
  export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib
  export GISRC=$HOME/.grassrc6
  export GRASS_PNGFILE=/tmp/grass6output.png
  export GRASS_TRUECOLOR=TRUE
  export GRASS_WIDTH=900
  export GRASS_PNG_COMPRESSION=1
  export GIS_LOCK=$$


  #test:
  # path to GRASS binaries and libraries:
  g.version
  export GISBASE=/usr/local/grass60
  export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib
  # path to GRASS settings file:
  export GISRC=$HOME/.grassrc6
  # use process ID (PID) as lock file number:
  export GIS_LOCK=$$
  # settings for graphical output (optional)
  export GRASS_PNGFILE=/tmp/grass6output.png
  export GRASS_TRUECOLOR=TRUE
  export GRASS_WIDTH=900
  export GRASS_PNG_COMPRESSION=1


  #this should print the GRASS version used.
Now you can test:
</pre>


Then you can launch other GRASS commands. This works within Shell scripts and also in the command line terminal.
  # this should print the GRASS version used:
  g.version
 
If this works, you can launch other GRASS commands. This works within Shell scripts and also in the command line terminal.

Revision as of 11:50, 24 June 2006

You have to set a couple of variables:

  # Example in bash shell syntax:
  # path to GRASS binaries and libraries:
  export GISBASE=/usr/local/grass60

  export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib

  # path to GRASS settings file:
  export GISRC=$HOME/.grassrc6

  # use process ID (PID) as lock file number:
  export GIS_LOCK=$$

  # settings for graphical output (optional)
  export GRASS_PNGFILE=/tmp/grass6output.png
  export GRASS_TRUECOLOR=TRUE
  export GRASS_WIDTH=900
  export GRASS_PNG_COMPRESSION=1

Now you can test:

  # this should print the GRASS version used:
  g.version

If this works, you can launch other GRASS commands. This works within Shell scripts and also in the command line terminal.