1g.ask(1)                      Grass User's Manual                     g.ask(1)
2
3
4

NAME

6       g.ask  - Prompts the user for the names of GRASS data base files.
7

KEYWORDS

9       general
10

SYNOPSIS

12       g.ask
13       g.ask help
14       g.ask  type=string   [prompt="string"]  element=string  [desc="string"]
15       unixfile=string
16
17   Parameters:
18       type=string
19           The type of query Options: old,new,any,mapset
20
21       prompt=
22           The prompt to be displayed to the user
23
24       element=string
25           The database element to be queried
26
27       desc=
28           A short description of the database element
29
30       unixfile=string
31           The name of a unix file to store the user's response
32

DESCRIPTION

34       g.ask is designed for shell scripts that need to prompt  the  user  for
35       the  name  of  a  data  base file in the user's current GRASS location.
36       After g.ask is invoked with needed parameters, it will query  the  user
37       for  a  file  name  of  the specified type and element.  After the user
38       responds to this query, the program will write four lines to  the  UNIX
39       output file specified by unixfile.
40

OUTPUT

42       Upon  receiving  the  user's  response  to its request for a file name,
43       g.ask writes four lines to the specified unixfile; this output file  is
44       placed in the user's current working directory, unless otherwise speciā€
45       fied, and contains the following lines:
46       name='some_name'
47       mapset='some_mapset'
48       fullname='some_fullname'
49       file='some_fullpath'
50
51
52       The output is /bin/sh commands to set the variable  name  to  the  file
53       name  specified  by  the  user  (of  the  element and type requested by
54       g.ask), mapset to the GRASS mapset in which this file resides (or  will
55       be  created),  fullname is the name with the mapset embedded in it, and
56       file to the full UNIX path name identifying this file.  These variables
57       may be set in the /bin/sh as follows: . unixfile
58
59       The  . is a shell command which means read the unixfile and execute the
60       commands found there.  It is NOT part of the unixfile name and MUST  be
61       followed by a space.
62

NOTES

64       The  user  may choose to simply hit the return key and not enter a file
65       name.  If this happens the variables will be set as follows:
66       name=
67       mapset=
68       fullname=
69       file=
70
71
72       The following is a way to test for this case:
73       if [ ! "$file" ]
74       then
75            exit
76       fi
77
78

SEE ALSO

80       d.ask, g.filename, g.findfile, g.gisenv, g.parser
81

AUTHOR

83       Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
84
85       Last changed: $Date: 2005/12/07 13:31:15 $
86
87       Full index
88
89
90
91GRASS 6.2.2                                                           g.ask(1)
Impressum