[GRASS-user] Detecting GRASS version when only specifying GRASS directory

Rainer M Krug r.m.krug at gmail.com
Tue Sep 13 03:03:48 EDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Hamish, Ahmadou,

Hamish: The file VERSIONNUMBER is exactly what I was looking for - thanks.

Ahmadou:

On 13/09/11 02:12, ahmadou dicko wrote:
> The way Rainer use R for scripting GRASS don't allow  him to use
> the GRASS_VERSION variable, so i think the only way is to use the
> second solution proposed by Hamish.

Exactly.

> 
> something like that should do the trick in R
> 
> readLines(paste(Sys.getenv("GISBASE"), "etc", "VERSIONNUMBER", sep
> = "/"))

Perfect.

> 
> 
> But if you launch R from GRASS or set some GRASS variable
> permanently you can simply do
> 
> Sys.getenv("GRASS_VERSION")

Terue - but as you pointed out, I am not running R from within GRASS,
so the file VERSIONNUMBER is the way to go.


Thanks a lot,

Rainer

> 
> 
> 
> 
> 2011/9/12 Hamish <hamish_b at yahoo.com <mailto:hamish_b at yahoo.com>>
> 
> Rainer wrote:
>> I am using GRASS from within an R script, and would need the
>> GRASS version. I do not know the startup script, so grass 
>> --version is not an option. Nevertheless, I have obviously 
>> specified the GRASS directory where the grass executables and 
>> scripts sit. Is there one which I can use to get the grass 
>> version?
> 
> If grass is started you can use the GRASS_VERSION enviro variable 
> or the g.version module to get it.
> 
> If GRASS is not started you can look in the 
> $GISBASE/etc/VERSIONNUMER file.
> 
> 
> Hamish
> 
> _______________________________________________ grass-user mailing
> list grass-user at lists.osgeo.org
> <mailto:grass-user at lists.osgeo.org> 
> http://lists.osgeo.org/mailman/listinfo/grass-user
> 
> 


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer at krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5vAFQACgkQoYgNqgF2egpSnwCfUZrg930ykKYaV97DCQV5hSx8
+SEAoIReUpAZOJ3B5M1WS7t3NoZ8xYga
=7s38
-----END PGP SIGNATURE-----


More information about the grass-user mailing list