[GRASS-user] Unix and Grass commands in Windows

Glynn Clements glynn at gclements.plus.com
Sun Apr 21 13:35:32 PDT 2013


Stephen Brearley wrote:

> Just wondering how best to execute Unix and Grass commands using Grass
> 6/7.0. I'm running Windows Vista, and had started installing Cygwin, but
> this seems to be massive, and not even sure if this is the best environment,
> as some users don't seem happy about it. I had initially thought I could use
> the Console window, but this appears not to accept Unix commands.

The console window doesn't recognise any commands; it's the shell
which is run in it which executes commands.

If you use the "Command Prompt" entry in the start menu, you'll get a
console window running cmd.exe (largely backward-compatible with DOS).

MSys and Cygwin each offer a version of bash, along with some
utilities. Cygwin provides a higher degree of Unix compatibility, but
is more heavyweight.

MSys and Cygwin each include a terminal emulator (rxvt for MSys,
mintty for Cygwin), and the corresponding icon uses this terminal
emulator to run bash. However, either version of bash can be run in a
Windows console window if that is preferred.

> I also tried the included MySys Unix console which appears to be a
> Bash shell, but this does not recognise Grass commands.

GRASS commands are designed to be run inside of a GRASS "session". 
Essentially, this requires certain environment variables to be set
(e.g. GISBASE must contain the path to the GRASS installation, GISRC
must contain the path to a file containing certain settings, PATH must
include the directories containing GRASS programs and DLLs).

GRASS is supplied with a batch file which sets the various environment
variables then starts a shell and/or a GUI.

> >What would you recommend is the best option if I want to use Grass quite a
> lot, but don't want to convert my PC to a fully fledged Linux system (unless
> that really is the best option, such as using an emulator).

GRASS 7 should run "natively" on Windows, i.e. it shouldn't require
bash or any Unix utilities. GRASS 6.x requires bash and standard
utilities in order to run various shell scripts (these have been
converted to Python in GRASS 7).

The Cygwin version should only be used if you particularly want a Unix
environment but only have a Windows system.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list