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

Vaclav Petras wenzeslaus at gmail.com
Wed Nov 13 16:59:39 PST 2013


On Wed, Nov 13, 2013 at 7:47 PM, Nikos Alexandris
<nik at nikosalexandris.net>wrote:

>  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).
>
>
>
> Maybe this should be added in /grass_addons/SUBMITTING_SCRIPTS ?
>
>
Hamish and Nikos, SUBMITTING is a great idea. That's the best place. And
once #2103 will be solved it will be ideal. The document can be much longer
then now, I believe.

I'm just not sure if this is for addons or trunk but just but it anywhere
for #2103 they might be merged.

https://trac.osgeo.org/grass/ticket/2103

And about Bash versus Python, I agree, I feel it the same, but at the end,
I always ends with Python. By the way, there is actually one thing which is
sometimes used and that is generation of bash code/script in Python and
then running it using bash command. Bit strange but powerful.

Vaclav

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


More information about the grass-dev mailing list