g.filename.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. automatically creates the <em>element</em> specified if it
  50. doesn't already exist. This makes it easy to add new files
  51. 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>The program exits with a 0 if everything is ok; it exits
  56. with a non-zero value if there is an error, in which case
  57. file=<em>'full_file_pathname'</em> is not output.
  58. <h2>SEE ALSO</h2>
  59. <em>
  60. <a href="g.findfile.html">g.findfile</a>,
  61. <a href="g.gisenv.html">g.gisenv</a>
  62. </em>
  63. <h2>AUTHOR</h2>
  64. Michael Shapiro,
  65. U.S.Army Construction Engineering Research Laboratory
  66. <p><i>Last changed: $Date$</i>