[GRASS-dev] [GRASS GIS] #2639: grass command should read commands from stdin as an interpreter would do

GRASS GIS trac at osgeo.org
Fri May 8 11:59:20 PDT 2020


#2639: grass command should read commands from stdin as an interpreter would do
-------------------------+-------------------------------------------------
  Reporter:  wenzeslaus  |      Owner:  grass-dev@…
      Type:              |     Status:  new
  enhancement            |
  Priority:  normal      |  Milestone:  8.0.0
 Component:  Startup     |    Version:  unspecified
Resolution:              |   Keywords:  interface, CLI, script, batch job,
       CPU:              |  GRASS_BATCH_JOB, init, standard input
  Unspecified            |   Platform:  All
-------------------------+-------------------------------------------------

Comment (by wenzeslaus):

 Using `--exec bash`, this starts to be almost all right:

 Input:

 {{{
 $ grass79 --tmp-location XY --exec bash <<EOF
 g.region -g
 g.proj -g
 EOF
 }}}

 Output:

 {{{
 Starting GRASS GIS...
 Creating new GRASS GIS location <tmploc>...
 Cleaning up temporary files...
 Executing <bash> ...
 projection=0
 zone=0
 n=1
 s=0
 w=0
 e=1
 nsres=1
 ewres=1
 rows=1
 cols=1
 cells=1
 name=xy_location_unprojected
 Execution of <bash> finished.
 Cleaning up temporary files...
 }}}

 With redirecting stdout to a file:

 {{{
 $ grass79 --tmp-location XY --exec bash > test.txt <<EOF
 g.region -g
 g.proj -g
 EOF
 }}}

 Output:

 {{{
 Starting GRASS GIS...
 Cleaning up temporary files...
 Executing <bash> ...
 Execution of <bash> finished.
 Cleaning up temporary files...
 }}}

 File content:

 {{{
 projection=0
 zone=0
 n=1
 s=0
 w=0
 e=1
 nsres=1
 ewres=1
 rows=1
 cols=1
 cells=1
 name=xy_location_unprojected
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/2639#comment:10>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list