[GRASS-dev] Using a multi-"${GIS_OPT_X}" input in a shell for loop
Nikos Alexandris
nik at nikosalexandris.net
Sat Nov 9 01:53:35 PST 2013
In past communications in the list I have found Glynn's, if I remember well, following piece of
code-suggestion (or similar):
# set to comma ===============================================================
IFS=,
# loop over...
for Image in ${GIS_OPT_MSX}
do
# check if Image exists
eval `g.findfile element=cell file="${Image}"`
if [ -z "$name" ]
then g.message -e "can't find the <${Image}> image."
exit 1
else g.message -v "* Low resolution image: ${Image}"
fi
done
# reset IFS ==================================================================
IFS=${Default_IFS}
Is it wrong to simply:
for Image in `echo $GIS_OPT_MSX | tr "," "\ "` ; do echo ${Image} ; done
Thank you, Nikos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20131109/34029a61/attachment.html>
More information about the grass-dev
mailing list