Next: , Previous: , Up: Top   [Contents][Index]


3 Required user defined variables

The following variables are expected to be defined before the MBFL code is evaluated. They are used by MBFL to compute values for its own variables.

Variable: script_PROGNAME

The name of the script. It is used, for example, in error and verbose messages.

Variable: script_AUTHOR

The name of the script author(s). It is used in copyright statements.

Variable: script_COPYRIGHT_YEARS

A comma separated list of years of copyright. It is used in copyright statements.

Variable: script_VERSION

The version number of the script. It is used in copyright statements and it can be directly queried using the command line options --version and --version-only.

Variable: script_LICENSE

The identifier of the license under which the script is released. Accepted values are: GPL or GPL2, GPL3, LGPL or LGPL2, LGPL3, BSD, liberal. It is used to select the appropriate value to be displayed when the user of the script selects the --license option. Predefined options

Variable: script_USAGE

Must be a string, of one or more lines, describing the synopsis of the program. It is usually something like:

script_USAGE="usage: ${script_PROGNAME} [options] ..."

if the script accepts either input from the stdin channel and input from a selected file, it is useful to present both cases:

script_USAGE="usage: ${script_PROGNAME} [options] <INPUT-FILE
usage: ${script_PROGNAME} [options] INPUT-FILE"

If the script defines multiple actions: it is better to define a synopsis description for every supported action, by setting this variable in the action–specific “before parsing options” function. actions for details.

Variable: script_DESCRIPTION

One line string providing a brief description of the program. It is used in the help screen (the one echoed when the --help option is used) right after the content of script_USAGE.

If the script defines multiple actions: it is better to define a usage description for every supported action, by setting this variable in the action–specific “before parsing options” function. actions for details.

Variable: script_EXAMPLES

One or more lines of text to be displayed at the end of the help screen, after the options description. It should contain examples of common invocations for the script.

If the script defines multiple actions: it is better to define a set of examples description for every supported action, by setting this variable in the action–specific “before parsing options” function. actions for details.

All the text in these variables is used as argument to the printf built–in command; in particular: script_DESCRIPTION and script_EXAMPLES are used as first argument to printf, so the escape sequences (in particular \t and \n) are expanded.

Examples

The following example shows how to declare the variables.

script_PROGNAME=myscript.sh
script_AUTHOR='Marco Maggi and Marco Maggi'
script_COPYRIGHT_YEARS='2002, 2003, 2004'
script_VERSION=1.0
script_LICENSE=GPL3
script_USAGE="usage: $script_PROGNAME [options] ..."
script_DESCRIPTION='Does this and that.'
script_EXAMPLES='Examples:

\tmyscript.sh --do-something arg arg ...
\tmyscript.sh --do-other arg arg ...'

Notice that script_DESCRIPTION and script_EXAMPLES do not end with a newline character.


Next: , Previous: , Up: Top   [Contents][Index]

This document describes version 3.0.0-devel.0 of Marcos Bash Functions Library.