Re: Declaration of GLOBAL variable fail in GRASS7

Markus Metz <[email protected]>
Newsgroups gmane.comp.gis.grass.user
Message-ID <CAG+h=FH=JpWWQen=G9SD5rgijQMS864LNBNe2XPHVnRrZ+RyEw@mail.gmail.com>
On Tue, Jan 23, 2018 at 12:01 PM, Markus Neteler <[email protected]> wrote:
>
> On Mon, Jan 22, 2018 at 2:04 PM, Marino Vetuschi Zuccolini
> <[email protected]> wrote:
> > Hello to all,
> > I’m trying to use well tested shell scripts with grass5/6 packages with
a
> > more recent grass7 in Mint distribution (from
ppa:ubuntugis/ubuntugis-stable)
> > realising a singular error:
> >
> > ERROR: Variable ‘LOCATION_NAME’ not set
> >
> > despite the variable declaration (with "export" keyword in bash) is
made INSIDE the script
> > or in the directly in the terminal.
>
> Do you intend to run GRASS GIS in a terminal without being explicitely
> in a session?
> If yes, please see here for instructions:
>
https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Bash_examples_.28GNU.2FLinux.29

As you can see there, LOCATION_NAME is not an environment variable, but a
GRASS variable stored in $GISRC. The relevant code sniplet is

-->
# Set the global grassrc file to individual file name
MYGISRC="$HOME/.grassrc.$GRASS_VERSION.$$"

echo "GISDBASE: $MYGISDBASE" > "$MYGISRC"
echo "LOCATION_NAME: $MYLOC" >> "$MYGISRC"
echo "MAPSET: $MYMAPSET" >> "$MYGISRC"
echo "GRASS_GUI: text" >> "$MYGISRC"

# path to GRASS settings file
export GISRC=$MYGISRC
<--

HTH,

Markus M

>
> Furthermore, due to flags and parameters standardization, some (minor)
> changes my be needed in your scripts:
>
https://trac.osgeo.org/grass/wiki/Grass7/NewFeatures74#MigratingfromGRASSGIS6toversion7.x
> (at page bottom)
>
> Best,
> Markus
>
> --
> Markus Neteler, PhD
> http://www.mundialis.de - free data with free software
> http://grass.osgeo.org
> http://courses.neteler.org/blog
> _______________________________________________
> grass-user mailing list
> [email protected]
> https://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.