[GRASS-user] Raster names under Linux

Glynn Clements glynn at gclements.plus.com
Tue Feb 2 16:35:07 EST 2010


Rich Shepard wrote:

> > I wrote a script for GRASS 6.4 under Ubuntu, in which I included the
> > commands r.in.gdal and g.region rast=xxx. When runningthe script I
> > received error messages illegal file name and character <not allowed. How
> > could I overcome this problem ?
> 
> Niels,
> 
>    Do the file names contain an underscore '_'? GRASS doesn't like that.
> Hyphens ('-') seem to be OK.

There are no problems with underscores in map names.

[However, if you're writing a shell script, you need to bear in mind
that underscores are allowed in variable names, so "$foo_bar" means
the value of the variable named "foo_bar". If you want the value of
the variable "foo" followed by the literal text "_bar", you need to
put braces around the variable name, i.e. "${foo}_bar".]

The characters which aren't allowed in map names, mapset names, etc
are:

	/ " ' @ , = *

plus space (32), control characters (< 32), delete (127), and 8-bit
characters (>= 128).

On Windows[1], the following characters are also prohibited:

	\ : ? < > |

[1] The prohibition also applies when using DOS/Windows filesystems
(FAT, VFAT, NTFS, SMBFS/CIFS) on e.g. Linux.

In r.mapcalc, a map name needs to be quoted if it contains any of the
following characters:

	^ # ( ) [ ] + - % > < ! & | ? : ; ~

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list