I'm trying to write a script that accepts either a delimited list for input
(like g.region rast=map1,map2,map3,...) or will interpret the given input as
a wildcard pattern if the appropriate flag is given also. What is the syntax
required when writing in bash to enable this functionality? The script I'm
writing uses r.patch in loop if a wildcard pattern is given, otherwise it
should accept single or multiple-delimited lists of input rasters by
default.
Doesn't the "multiple" argument do this automatically in the g_parser()
system?
Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University
From: "Patton, Eric" <epatton@nrcan.gc.ca>
Date: Fri, 9 Jun 2006 15:03:58 -0300
To: "'grass-dev@grass.itc.it'" <grass-dev@grass.itc.it>
Subject: [GRASS-dev] Proper formatting of input parameters for bash scripts
I'm trying to write a script that accepts either a delimited list for input
(like g.region rast=map1,map2,map3,...) or will interpret the given input as
a wildcard pattern if the appropriate flag is given also. What is the syntax
required when writing in bash to enable this functionality? The script I'm
writing uses r.patch in loop if a wildcard pattern is given, otherwise it
should accept single or multiple-delimited lists of input rasters by
default.
I'm trying to write a script that accepts either a delimited list for
input (like g.region rast=map1,map2,map3,...) or will interpret the
given input as a wildcard pattern if the appropriate flag is given
also. What is the syntax required when writing in bash to enable this
functionality? The script I'm writing uses r.patch in loop if a
wildcard pattern is given, otherwise it should accept single or
multiple-delimited lists of input rasters by default.
Adding
#% multiple : yes
to the option def'n will "allow" multiple input names (for shell scripts
this only really changes the help text I think)
For patterns, use "g.mlist sep=, pat=$GIS_OPT_input" to parse the string.
I don't know if using muliple+patterns will work on the same input line.
Maybe some g.mlist enhancement is required for that.