[GRASS-user] running Grass in batch mode without a script

Hi,

I'm trying to add a feature to the Emacs grass-mode, allowing the user
to create new locations interactively as they start the Grass session.
The easiest way to do this would be to start a separate grass session to
create the location in batch mode, then return to the normal setup
procedures already in place.

I can create the location with:

grass -c source_file ~/grassdata/location_name

But this opens a new interactive instance of Grass, before I've had a
chance to set up the Emacs processing. Using the environmental variable
GRASS_BATCH_JOB requires that it point to a shell script, but I'm not
sure if there is a way to install a shell script within an Emacs package
that is portable among Windows, Mac and Linux.

So is there a way to run a grass job in batch mode without invoking a
script? Or other suggestions?

Thanks!

--
  Tyler Smith
  plantarum.ca

On Wed, Jan 28, 2015 at 9:50 PM, Tyler Smith <tyler@plantarum.ca> wrote:
...

So is there a way to run a grass job in batch mode without invoking a
script?

Yes, you just need to set some environment variables, see e.g. here:

http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Bash_examples_.28GNU.2FLinux.29

Markus

On Wed, Jan 28, 2015, at 04:14 PM, Markus Neteler wrote:

On Wed, Jan 28, 2015 at 9:50 PM, Tyler Smith <tyler@plantarum.ca> wrote:
...
> So is there a way to run a grass job in batch mode without invoking a
> script?

Yes, you just need to set some environment variables, see e.g. here:

http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Bash_examples_.28GNU.2FLinux.29

Thank you Markus. I realized that to use it that way I'd have to
determine what kind of file was being selected, in order to know if I
needed to call r.in.gdal or v.in.ogr. In the end it turned out to be
simpler to redo the code that calls the grass program itself, so I could
take advantage of 'grass -c file' and avoid that step. It appears to
work now, although I haven't given it much testing.

Best,

Tyler