A number of gdbmtool
parameters is kept in its internal
variables. To examine or modify variables, use the set
command
(see set).
Whether to ask for confirmation before certain destructive operations, such as truncating the existing database.
Default is true
.
Primary prompt string. Its value can contain conversion specifiers, consisting of the ‘%’ character followed by another character. These specifiers are expanded in the resulting prompt as follows:
Sequence | Expansion |
---|---|
%f | name of the current database file |
%p | program invocation name |
%P | package name (GDBM ) |
%v | program version |
%_ | single space character |
%% | % |
The default value is ‘%p>%_’, i.e. the program name, followed by a “greater than” sign, followed by a single space.
Secondary prompt. See ps1
for a description of its value.
This prompt is displayed before reading the second and subsequent
lines of a multi-line command.
The default value is ‘%_>%_’.
A string used to delimit fields of a structured datum on output (see definitions).
Default is ‘,’ (a comma). This variable cannot be unset.
A string used to delimit array items when printing a structured datum (see definitions).
Default is ‘,’ (a comma). This variable cannot be unset.
The name and command line of the pager program to pipe output to. This program is used in interactive mode when the estimated number of output lines is greater then the number of lines on your screen.
The default value is inherited from the environment variable
PAGER
. Unsetting this variable disables paging.
Whether to display a welcome banner at startup. To affect
gdbmtool
, this variable should be set in a startup script
file (see startup files). See -q option.
The following variables control how the database is opened:
Sets the block size. See block_size. Unset by default.
Sets the cache size. See GDBM_SETCACHESIZE. By default this variable is not set.
Open mode. The following values are allowed:
Truncate the database if it exists or create a new one. Open it in read-write mode.
Technically, this sets the GDBM_NEWDB
flag in call to gdbm_open
.
See GDBM_NEWDB.
Open the database in read-write mode. Create it if it does not exist. This is the default.
Technically speaking, it sets the GDBM_WRCREAT
flag in call to
gdbm_open
. See GDBM_WRCREAT.
Open the database in read-only mode. Signal an error if it does not exist.
This sets the GDBM_READER
flag (see GDBM_READER).
Attempting to set any other value or to unset this variable results in error.
File mode (in octal) for creating new database files and database dumps.
Lock the database. This is the default.
Setting this variable to false or unsetting it results in passing
GDBM_NOLOCK
flag to gdbm_open
(see GDBM_NOLOCK).
Use memory mapping. This is the default.
Setting this variable to false or unsetting it results in passing
GDBM_NOMMAP
flag to gdbm_open
(see GDBM_NOMMAP).
Flush all database writes on disk immediately. Default is false. See GDBM_SYNC.
Enables the coalesce mode, i.e. merging of the freed blocks of
GDBM files with entries in available block lists. This provides for
effective memory management at the cost of slight increase in
execution time when calling gdbm_delete
. See GDBM_SETCOALESCEBLKS.
This variable affects the open
command and should be set
before invoking it.
Set to true
, enables the use of central free block pool in
newly opened databases. See GDBM_SETCENTFREE.
This variable affects the open
command and should be set
before invoking it.
The following commands are used to list or modify the variables:
When used without arguments, lists all variables and their values.
Unset variables are shown after a comment sign (‘#’). For string
and numeric variables, values are shown after an equals sign. For
boolean variables, only the variable name is displayed if the variable
is true
. If it is false
, its name is prefixed with
‘no’.
For example:
ps1="%p>%_" ps2="%_>%_" delim1="," delim2="," confirm # cachesize is unset # blocksize is unset open="wrcreat" lock mmap nosync pager="less" # quiet is unset
If used with arguments, the set
command alters the specified
variables. In this case, arguments are variable assignments in the
form ‘name=value’. For boolean variables, the
value is interpreted as follows: if it is numeric, 0
stands for false
, any non-zero value stands for true
.
Otherwise, the values on
, true
, and yes
denote
true
, and off
, false
, no
stand for
false
. Alternatively, only the name of a boolean variable can be
supplied to set it to true
, and its name prefixed with
no
can be used to set it to false. For example, the following
command sets the delim2
variable to ‘;’ and the
confirm
variable to false
:
set delim2=";" noconfirm
Unsets the listed variables. The effect of unsetting depends on the
variable. Unless explicitly described in the discussion of the
variables above, unsetting a boolean variable is equivalent to setting it to
false
. Unsetting a string variable is equivalent to assigning it
an empty string.