1g.filename(1) GRASS GIS User's Manual g.filename(1)
2
3
4
6 g.filename - Prints GRASS data base file names.
7
9 general, map management, scripts
10
12 g.filename
13 g.filename --help
14 g.filename [-c] element=string file=string [mapset=string] [--help]
15 [--verbose] [--quiet] [--ui]
16
17 Flags:
18 -c
19 Create element directory in the current mapset
20 If element directory for database file does not exist, create it
21
22 --help
23 Print usage summary
24
25 --verbose
26 Verbose module output
27
28 --quiet
29 Quiet module output
30
31 --ui
32 Force launching GUI dialog
33
34 Parameters:
35 element=string [required]
36 Name of an element
37
38 file=string [required]
39 Name of a database file
40
41 mapset=string
42 Name of a mapset (default: current)
43
45 g.filename is designed for Bourne shell scripts that need to know the
46 full file name, including it’s path, for mapset elements, like raster,
47 vector and site maps, region definitions and imagery groups.
48
49 The list of element names to search for is not fixed; any subdirectory
50 of the mapset directory is a valid element name.
51
52 However, the user can find the list of standard GRASS GIS element names
53 in the file $GISBASE/etc/element_list. This is the file which g.re‐
54 move/g.rename/g.copy use to determine which files need to be
55 deleted/renamed/copied for a given entity type.
56
58 g.filename writes one line to standard output:
59 file=’full_file_pathname’ The output is a /bin/sh command to set the
60 variable specified by the file name to the full UNIX path name for the
61 data base file. This variable may be set in the /bin/sh as follows:
62 eval `g.filename element=name mapset=name file=name`
63
65 This module generates the filename, but does not care if the file (or
66 mapset or element) exists or not. This feature allows shell scripts to
67 create new data base files as well as use existing ones.
68
69 If the mapset is the current mapset, g.filename can automatically cre‐
70 ate the element specified if it doesn’t already exist when -c flag is
71 used. This makes it easy to add new files to the data base without hav‐
72 ing to worry about the existence of the required data base directories.
73 (This program will not create a new mapset, however, if that specified
74 does not currently exist.)
75
76 This module should not be used to create directories which are at the
77 level of what this module refer to as files, i.e., directory which car‐
78 ries a name specified by a user (such as vector map directories) should
79 not be created using this module. Standard library functions coming
80 with any given language are a more appropriate tool for that.
81
82 The program exits with a 0 if everything is ok; it exits with a
83 non-zero value if there is an error, in which case
84 file=’full_file_pathname’ is not output.
85
87 g.findfile, g.gisenv
88
90 Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
91
93 Available at: g.filename source code (history)
94
95 Accessed: Mon Jun 20 16:45:50 2022
96
97 Main index | General index | Topics index | Keywords index | Graphical
98 index | Full index
99
100 © 2003-2022 GRASS Development Team, GRASS GIS 8.2.0 Reference Manual
101
102
103
104GRASS 8.2.0 g.filename(1)