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

Nikos Alexandris nik at nikosalexandris.net
Wed Nov 13 01:42:37 PST 2013


Nikos wrote:

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

Hamish wrote:

> 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).

Thank you Hamish.

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.

That's right.

Nikos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20131113/4d58388e/attachment.html>


More information about the grass-dev mailing list