[GRASS-dev] [GRASS GIS] #3996: Allow multiple --exec's

#3996: Allow multiple --exec's
-------------------------+---------------------------------
Reporter: jidanni | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: trivial | Milestone:
Component: Startup | Version: git-releasebranch78
Keywords: | CPU: Unspecified
Platform: Unspecified |
-------------------------+---------------------------------
Enhancement idea:

Even though one can run whole shell scripts,
how about also allowing more than one "grass --exec"?

Perhaps allow multiple --exec's using Unix find(1)'s method:

{{{
-exec ... ... \; -exec ... ... \;
}}}

In fact it one fails, don't run the rest, just like Unix.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3996&gt;
GRASS GIS <https://grass.osgeo.org>

#3996: Allow multiple --exec's
--------------------------+---------------------------------
  Reporter: jidanni | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: trivial | Milestone:
Component: Startup | Version: git-releasebranch78
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mankoff):

Somewhat related - you can use HEREDOCs:

{{{
grass -c template.tif ./G --exec <<EOF
r.external input=foo.tif output=foo
r.out.gdal input=foo output=bar.tif
EOF
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3996#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3996: Allow multiple --exec's
--------------------------+---------------------------------
  Reporter: jidanni | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: trivial | Milestone:
Component: Startup | Version: git-releasebranch78
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by jidanni):

Replying to [comment:1 mankoff]:
> Somewhat related - you can use HEREDOCs
Great to know, and **should be documented**.

(Alas I am mainly doing one-liners in Makefiles.)

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3996#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3996: Allow multiple --exec's
--------------------------+---------------------------------
  Reporter: jidanni | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: trivial | Milestone:
Component: Startup | Version: git-releasebranch78
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by mankoff):

HEREDOCs work in Makefiles.

This seems like a bad idea https://stackoverflow.com/questions/5873025
/heredoc-in-a-makefile

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3996#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#3996: Allow multiple --exec's
--------------------------+---------------------------------
  Reporter: jidanni | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: trivial | Milestone:
Component: Startup | Version: git-releasebranch78
Resolution: | Keywords:
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by jidanni):

Replying to [comment:3 mankoff]:
> HEREDOCs work in Makefiles.
>
> This seems like a bad idea...
Yup, and that's why I learned perl while the other kids learned python. At
least good old ";"'s still work.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3996#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#3996: Allow multiple --exec's
--------------------------+---------------------------------
  Reporter: jidanni | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: trivial | Milestone:
Component: Startup | Version: git-releasebranch78
Resolution: | Keywords: exec grass.py init
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------
Changes (by wenzeslaus):

* keywords: => exec grass.py init

Comment:

Replying to [comment:2 jidanni]:
> Replying to [comment:1 mankoff]:
> > Somewhat related - you can use HEREDOCs
> Great to know, and **should be documented**.

It does not work in a way, at least I think, it should work, so that's
partially the reason it is not in documentation. There is actually a
ticket for it: #2639, so I suggest have further discussion on this there
(if needed).

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3996#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>

#3996: Allow multiple --exec's
--------------------------+---------------------------------
  Reporter: jidanni | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: trivial | Milestone:
Component: Startup | Version: git-releasebranch78
Resolution: | Keywords: exec grass.py init
       CPU: Unspecified | Platform: Unspecified
--------------------------+---------------------------------

Comment (by wenzeslaus):

Back to the `--exec ... \; --exec ... \;` enhancement:

Before somebody dives into implementing this. Do you want to elaborate on
the syntax, use cases, examples, edge cases, and similarities (and
differences) to other tools besides //find//. That would be good to have
before committing to support additional syntax when there are other ways
to achieve the same (for example, aforementioned here document, an `.sh`
script, or `--exec bash -c "... ; ...;"`.)

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3996#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>