[GRASS-dev] g.parser: Note on setting bash' IFS to parse separate identities

Nikos Alexandris nik at nikosalexandris.net
Tue Nov 4 05:11:05 PST 2014


Nikos Alexandris wrote:

>> --%<---
>> ...individual comma separated identities for an option named "input"
>> can be parsed with the following Bash shell code:
>>
>> IFS=,
>> for opt in $GIS_OPT_INPUT ; do
>>      ... "$opt"
>> done
>> --->%--
>>
>> Doesn't this require to set the IFS back to what it was?  Maybe note 
>> it
>> too?

Glynn Clements wrote:

> Yes.
>
> Or even just remove the reference to bash from the 7.x documentation.
> If you're using 7.x, Python is almost mandatory, so why would you
> write bash scripts?

I recently switched to all-Python :-). Yet, incomplete notes still 
remain incomplete.

By the way, in Python, is   .split(',')   the only way to seprate 
multiple (input) identities in a list/dictionary? Shouldn't the parser, 
with the option "multiple: yes" do this already for the scripter?

For example, in

#%option
#% key: msx
#% type: string
#% gisprompt: old,double,raster
#% description: Low resolution multi-spectral image(s)
#% required: yes
#% multiple: yes
#%end

it would be nice to have a new list after

newlist = options['msx']

Or would this cause trouble?

Thank you,
Nikos


More information about the grass-dev mailing list