[GRASS-dev] Using a multi-"${GIS_OPT_X}" input in a shell for loop

Hamish hamish_b at yahoo.com
Wed Nov 13 01:06:15 PST 2013


Nikos wrote:
>> for Image in `echo $GIS_OPT_MSX | tr "," "\ "` ; do echo ${Image}  ;  done

Curly brackets do nothing to protect the contents of a variable. Using them
tricks new bash coders into thinking they are protected when they are not.
To avoid propagating the damaging myth, only use them when you actually need
them (eg to protect the variable name from following characters, not its contents).

Vaclav:
> Is GIS_OPT_MSX also in GRASS 7 (trunk)?

That's just going to be the contents of a msx= command line option defined in the
script header's #% definition.


regards,
Hamish


More information about the grass-dev mailing list