manpagez: man pages & more
info gdbm
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20.2.1 Shell Variables

A number of gdbmtool parameters is kept in its internal variables.

gdbmtool variable: bool confirm

Whether to ask for confirmation before certain destructive operations, such as truncating the existing database.

Default is ‘true’.

gdbmtool variable: string ps1

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:

SequenceExpansion
%fname of the current database file
%pprogram invocation name
%Ppackage name (‘GDBM’)
%vprogram 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.

gdbmtool variable: string ps2

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 ‘%_>%_’.

gdbmtool variable: string delim1

A string used to delimit fields of a structured datum on output (see section Data Definitions).

Default is ‘,’ (a comma). This variable cannot be unset.

gdbmtool variable: string delim2

A string used to delimit array items when printing a structured datum (see section Data Definitions).

Default is ‘,’ (a comma). This variable cannot be unset.

gdbmtool variable: string pager

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.

gdbmtool variable: bool quiet

Whether to display a welcome banner at startup. This variable should be set in a startup script file (see section Startup Files). See -q option.

The following variables control how the database is opened:

gdbmtool variable: numeric blocksize

Sets the block size. See section block_size. Unset by default.

gdbmtool variable: numeric cachesize

Sets the cache size. See section GDBM_SETCACHESIZE. By default this variable is not set.

gdbmtool variable: string open

Open mode. The following values are allowed:

newdb

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 section GDBM_NEWDB.

wrcreat
rw

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 section GDBM_WRCREAT.

reader
readonly

Open the database in read-only mode. Signal an error if it does not exist.

This sets the ‘GDBM_READER’ flag (see section GDBM_READER).

Attempting to set any other value or to unset this variable produces an error.

gdbmtool variable: number filemode

File mode (in octal) for creating new database files and database dumps.

gdbmtool variable: bool lock

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 section GDBM_NOLOCK).

gdbmtool variable: bool mmap

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 section GDBM_NOMMAP).

gdbmtool variable: bool sync

Flush all database writes on disk immediately. Default is false. See section GDBM_SYNC.

The following commands are used to list or modify the variables:

command verb: set [assignments]

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
command verb: unset variables

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.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on January 24, 2014 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.