1GMT_SHELL_FUNCTIONS.SH(1)    Generic Mapping Tools   GMT_SHELL_FUNCTIONS.SH(1)
2
3
4

NAME

6       gmt_shell_functions.sh  -  Practical functions to be used in GMT bourne
7       shell scripts
8

SYNOPSIS

10       gmt_init_tmpdir
11       gmt_remove_tmpdir
12       gmt_clean_up [prefix]
13       gmt_message message
14       gmt_abort message
15       gmt_nrecords file(s)
16       gmt_nfields string
17       gmt_get_field string
18       gmt_get_region file(s) [options]
19       gmt_get_gridregion file [options]
20       gmt_get_map_width -R -J
21       gmt_get_map_height -R -J
22       gmt_set_psfile file
23       gmt_set_framename prefix framenumber
24       gmt_set_framenext framenumber
25

DESCRIPTION

27       gmt_shell_functions.sh provides a set of functions  to  Bourne  (again)
28       shell  scripts  in  support  of  GMT.   The calling shell script should
29       include the following line, before the functions can be used:
30
31       . gmt_shell_functions.sh
32
33       Once included in a  shell  script,  gmt_shell_functions.sh  allows  GMT
34       users  to  do  some scripting more easily than otherwise. The functions
35       made available are:
36
37       gmt_init_tmpdir
38              Creates a temporary directory in /tmp or (when defined)  in  the
39              directory specified by the environment variable TMPDIR. The name
40              of the temporary directory is returned as  environment  variable
41              GMT_TMPDIR.  This  function also causes GMT to run in `isolation
42              mode', i.e. all temporary files will be  created  in  GMT_TMPDIR
43              and the .gmtdefaults file will not be adjusted.
44
45       gmt_remove_tmpdir
46              Removes  the temporary directory and unsets the GMT_TMPDIR envi‐
47              ronment variable.
48
49       gmt_cleanup
50              Remove all files and directories in which  the  current  process
51              number  is  part  of  the  file name.  If the optional prefix is
52              given then we also delete all files and directories that  begins
53              with the given prefix.
54
55       gmt_message
56              Send a message to standard error.
57
58       gmt_abort
59              Send a message to standard error and exit the shell.
60
61       gmt_nrecords
62              Returns the total number of lines in file(s)
63
64       gmt_nfields
65              Returns the number of fields or words in string
66
67       gmt_get_field
68              Returns  the  given  field in a string. Must pass string between
69              double quotes to preserve it as one item.
70
71       gmt_get_region
72              Returns the region in the form w/e/s/n based on the data in  ta‐
73              ble file(s). Optionally add -Idx/dy to round off the answer.
74
75       gmt_get_gridregion
76              Returns  the region in the form w/e/s/n based on the header of a
77              grid file. Optionally add -Idx/dy to round off the answer.
78
79       gmt_map_width
80              Expects the user to give the desired -R -J settings and  returns
81              the map width in the current measurement unit.
82
83       gmt_map_height
84              Expects  the user to give the desired -R -J settings and returns
85              the map height in the current measurement unit.
86
87       gmt_set_psfile
88              Create the output PostScript file name based on the base name of
89              a given file (usually the script name $0).
90
91       gmt_set_framename
92              Returns  a  lexically ordered filename stem (i.e., no extension)
93              given the file prefix and the  current  frame  number,  using  a
94              width of 6 for the integer including leading zeros.  Useful when
95              creating animations and lexically sorted filenames are required.
96
97       gmt_set_framenext
98              Accepts the current frame integer counter and returns  the  next
99              integer counter.
100

NOTES

102       1. These functions only work in the bourne shell (sh) and their deriva‐
103       tives (like ash, bash, ksh and zsh).  These functions do  not  work  in
104       the  C shell (csh) or their derivatives (like tcsh), and cannot be used
105       in DOS batch scripts either.
106       2. gmt_shell_functions.sh were first introduced in  GMT  version  4.2.2
107       and  have  since been regularly expanded with other practical scripting
108       short-cuts. If you want to suggest other functions,  please  do  so  by
109       mailing to the GMT mailing list: gmt-help@lists.hawaii.edu.
110

SEE ALSO

112       GMT(1), sh(1), bash(1), minmax(1), grdinfo(1)
113
114
115
116GMT 4.5.6                         10 Mar 2011        GMT_SHELL_FUNCTIONS.SH(1)
Impressum