1g.ask(1) Grass User's Manual g.ask(1)
2
3
4
6 g.ask - Prompts the user for the names of GRASS data base files.
7
9 general
10
12 g.ask
13 g.ask help
14 g.ask type=string [prompt="string"] element=string [desc="string"]
15 unixfile=string [--verbose] [--quiet]
16
17 Parameters:
18 type=string
19 The type of query
20 Options: old,new,any,mapset
21
22 prompt=
23 The prompt to be displayed to the user
24
25 element=string
26 The database element to be queried
27
28 desc=
29 A short description of the database element
30
31 unixfile=string
32 The name of a unix file to store the user's response
33
35 g.ask is designed for shell scripts that need to prompt the user for
36 the name of a data base file in the user's current GRASS location.
37 After g.ask is invoked with needed parameters, it will query the user
38 for a file name of the specified type and element. After the user
39 responds to this query, the program will write four lines to the UNIX
40 output file specified by unixfile.
41
43 Upon receiving the user's response to its request for a file name,
44 g.ask writes four lines to the specified unixfile; this output file is
45 placed in the user's current working directory, unless otherwise speci‐
46 fied, and contains the following lines:
47 name='some_name'
48 mapset='some_mapset'
49 fullname='some_fullname'
50 file='some_fullpath'
51
52
53 The output is /bin/sh commands to set the variable name to the file
54 name specified by the user (of the element and type requested by
55 g.ask), mapset to the GRASS mapset in which this file resides (or will
56 be created), fullname is the name with the mapset embedded in it, and
57 file to the full UNIX path name identifying this file. These variables
58 may be set in the /bin/sh as follows: . unixfile
59
60 The . is a shell command which means read the unixfile and execute the
61 commands found there. It is NOT part of the unixfile name and MUST be
62 followed by a space.
63
65 The user may choose to simply hit the return key and not enter a file
66 name. If this happens the variables will be set as follows:
67 name=
68 mapset=
69 fullname=
70 file=
71
72
73 The following is a way to test for this case:
74 if [ ! "$file" ]
75 then
76 exit
77 fi
78
79
81 d.ask, g.filename, g.findfile, g.gisenv, g.parser
82
84 Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
85
86 Last changed: $Date: 2005-12-07 14:31:16 +0100 (Wed, 07 Dec 2005) $
87
88 Full index
89
90 © 2003-2008 GRASS Development Team
91
92
93
94GRASS 6.3.0 g.ask(1)