Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this shell script:

r.mapcalc water = 120
d.rast water
while [ $i != 100 ]
    while [ $n != 10 ]
            r.mapcalc < water.mapcalc
            d.rast water
            n='expr $n + 1'
        g.copy rast=water,water.$i
        i = 'expr $i + 1'

It is from I understand the syntax of the code since I am a programmer, but I cannot understand the line r.mapcalc < water.mapcalc. What does it mean? Sorry first time to use a shell script.

share|improve this question

It's input redirection -- just like you can redirect the output of a command into a file,:

command > outfile.txt

you can redirect the input from a file:

command < infile.txt

This is the same as:

cat infile.txt | command

Hopefully helpful!

share|improve this answer
I do not know if I understood it correctly. Does it mean that the output of the water.mapcalc is "redirected" to the command r.mapcalc? But, what does the command r.mapcalc compute? Isn't it that the r.mapcalc command needs additional parameters in order to work (map name and value)? I'm trying to make the Hydrologic Simulation in work. Thanks – teamAngat Feb 21 '11 at 13:33 should help. r.mapcalc is general purpose map algebra, and it will compute whatever the contents of the 'water.mapcalc' file tells it to compute. – Dan S. Feb 21 '11 at 21:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.