Opened 5 years ago

Last modified 5 years ago

#3996 new enhancement

Allow multiple --exec's

Reported by: jidanni Owned by: grass-dev@…
Priority: trivial Milestone: 7.8.3
Component: Startup Version: git-releasebranch78
Keywords: exec grass.py init Cc:
CPU: Unspecified Platform: Unspecified

Description

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.

Change History (7)

comment:1 by mankoff, 5 years ago

Somewhat related - you can use HEREDOCs:

rm -fR ~/Desktop/G
grass -c EPSG:3413 ./Desktop/G --exec <<EOF
g.region -p
g.region e=100 n=100 res=10 -p
EOF
Version 1, edited 5 years ago by mankoff (previous) (next) (diff)

in reply to:  1 comment:2 by jidanni, 5 years ago

Replying to mankoff:

Somewhat related - you can use HEREDOCs

Great to know, and should be documented.

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

comment:3 by mankoff, 5 years ago

HEREDOCs work in Makefiles.

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

in reply to:  3 comment:4 by jidanni, 5 years ago

Replying to 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 in Makefiles.

Last edited 5 years ago by jidanni (previous) (diff)

comment:5 by wenzeslaus, 5 years ago

Keywords: exec grass.py init added

Replying to jidanni:

Replying to 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).

in reply to:  description comment:6 by wenzeslaus, 5 years ago

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 "... ; ...;".)

comment:7 by neteler, 5 years ago

Milestone: 7.8.3
Note: See TracTickets for help on using tickets.