[GRASS-dev] Proper formatting of input parameters for bash scripts

Hamish hamish_nospam at yahoo.com
Mon Jun 12 00:57:08 EDT 2006


Eric Patton wrote:
> 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.


Hamish




More information about the grass-dev mailing list