I created a list of files (NPPFILES) using g.mlist command in GRASS 7. Now I would like to export these files as .tiff files. I tried this command in GRASS prompt

for files in $NPPFILES; do
r.out.gdal input="$NPPFILES" output="$NPPFILES.tiff" format=GTiff ; done

This is not working for me. I'm running it in the directory where output files need to be stored, still no result.

1 Answer 1


You need to iterate through the files, so your loop should be as follows:

for file in $NPPFILES
    r.out.gdal input=$file output=$file.tif format=GTiff 

You should add the semi-colons if you write the loop on one line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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