var

Bareos

Does variable expansion.

Synopsis

var [<text> ...]

Words without brackets are required, [ ] marks optional parts, a | b alternatives, ... a repeatable argument and [,...] a comma separated list.

Description

Expands variables in a text the way the Director does for volume names (LabelFormat) and prints the result, so a LabelFormat can be tried before it goes into the configuration. Supported are date and time variables such as ${Year} and ${Month}, job variables such as ${Job}, ${Client}, ${Pool} and ${NumVols}, counters, environment variables, and operations like :u, :l, :p and :s/pattern/replacement/.

The values come from the console job of the session: job, client, pool and storage are the defaults of the first job in the configuration, ${Type} is Console and ${JobId} is 0. The command opens the session catalog. ${Counter+} increments a counter permanently. Unknown variables stay unchanged. Without text odir prints an empty line.

Arguments

ArgumentTypeValues / sourceDefaultFlagsDescription
<text>stringrepeatable, positionalText with variables to expand.

Examples

Try a date based volume label:

var Full-${Year}${Month}${Day}

Pool name with the volume count padded to four digits:

var ${Pool}-${NumVols:p/4/0/r}

See also

Command reference