g.filename.html 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <h2>DESCRIPTION</h2>
  2. <em>g.filename</em> is designed for Bourne shell scripts that need to know
  3. the full file name, including it's path, for mapset elements, like raster,
  4. vector and site maps, region definitions and imagery groups.
  5. <p>The list of element names to search for is not fixed; any subdirectory of the
  6. mapset directory is a valid element name.
  7. <p>However, the user can find the list of standard GRASS GIS element names in
  8. the file <tt>$GISBASE/etc/element_list</tt>. This is the file which
  9. g.remove/g.rename/g.copy use to determine which files need to be
  10. deleted/renamed/copied for a given entity type.
  11. <!-- unused
  12. <h2>OPTIONS</h2>
  13. <h3>Parameters:</h3>
  14. <dl>
  15. <dt><b>element=</b><em>name</em>
  16. <dd>The name of a GRASS data base element (i.e., directory
  17. within the GRASS mapset location).
  18. <dt><b>mapset=</b><em>name</em>
  19. <dd>The name of a GRASS data base mapset. As a
  20. convenience, a single dot (.) can be used to designate the
  21. current mapset.
  22. <dt><b>file=</b><em>name</em>
  23. <dd>The name of a GRASS data base file.
  24. </dl>
  25. -->
  26. <h2>OUTPUT</h2>
  27. <em>g.filename</em>
  28. writes one line to standard output:
  29. <dl>
  30. <dd>
  31. file='<em>full_file_pathname'</em>
  32. </dl>
  33. The output is a <em>/bin/sh</em> command to set the
  34. variable specified by the file <em>name</em> to the full
  35. UNIX path name for the data base file. This variable may
  36. be set in the <em>/bin/sh</em> as follows:
  37. <dl>
  38. <dd>
  39. <div class="code"><pre>
  40. eval `g.filename element=name mapset=name file=name`
  41. </pre></div>
  42. </dl>
  43. <h2>NOTES</h2>
  44. This module generates the filename, but does not care if the file (or mapset
  45. or element) exists or not. This feature allows shell scripts to create new data
  46. base files as well as use existing ones.
  47. <p>
  48. If the mapset is the current mapset, <em>g.filename</em>
  49. can automatically create the <em>element</em> specified if it
  50. doesn't already exist when <b>-c</b> flag is used. This makes it easy
  51. to add new files to the data base without having to worry about the
  52. existence of the required data base directories. (This
  53. program will not create a new mapset, however, if that
  54. specified does not currently exist.)
  55. <p>
  56. This module should not be used to create directories which are at the level
  57. of what this module refer to as files, i.e., directory which carries a name
  58. specified by a user (such as vector map directories) should not be created
  59. using this module. Standard library functions coming with any given language
  60. are a more appropriate tool for that.
  61. <p>The program exits with a 0 if everything is ok; it exits
  62. with a non-zero value if there is an error, in which case
  63. file=<em>'full_file_pathname'</em> is not output.
  64. <h2>SEE ALSO</h2>
  65. <em>
  66. <a href="g.findfile.html">g.findfile</a>,
  67. <a href="g.gisenv.html">g.gisenv</a>
  68. </em>
  69. <h2>AUTHOR</h2>
  70. Michael Shapiro,
  71. U.S.Army Construction Engineering Research Laboratory