[GRASSLIST:4755] Re: batch jobs

Christoph Hoegl C.Hoegl at gmx.net
Wed Oct 16 18:16:28 EDT 2002



m.wegmann at web.de said:
> hello, 
> I have a couple of commands which I have to run on each image. Would
> it be possible to merge these commands and only change the input and
> output each time for each image? 

> like input=map1 output=map1a

> command x  in=map1 out=x command y  in=x out=y and so on until the
> final out=map1a

> as far as I understood the use of shell scripts, they are desigend to
> do this. But how do I write them and load them into GRASS?

> thanks for your help,  Martin


What about this approach:

write all your actions in a loop like this (this expects you're using bash 
(standard shell on Linux)

for i in all_filenames_go_here ; do
x in=$i out=$i.x.out
y in=$i.x.out out=$i.y.out
done

you may also like to do some renaming on the way:


e.g. there are some files named *.bla to be processed by the tools x and y
for i in *.bla ; do 
$basename=${i%.bla}
x in=$i out=$basename.suffix
y in=$basename.suffix out=$basename.sfx2
done

kind regards,
Christoph






More information about the grass-user mailing list