kpathsea: Variable expansion
5.3.2 Variable expansion
------------------------
'$foo' or '${foo}' in a path element is replaced by (1) the value of an
environment variable 'foo' (if defined); (2) the value of 'foo' from
'texmf.cnf' (if defined); (3) the empty string.
If the character after the '$' is alphanumeric or '_', the variable
name consists of all consecutive such characters. If the character
after the '$' is a '{', the variable name consists of everything up to
the next '}' (braces may not be nested around variable names).
Otherwise, Kpathsea gives a warning and ignores the '$' and its
following character.
You must quote the $'s and braces as necessary for your shell.
_Shell_ variable values cannot be seen by Kpathsea, i.e., ones defined
by 'set' in C shells and without 'export' in Bourne shells.
For example, given
setenv tex /home/texmf
setenv TEXINPUTS .:$tex:${tex}prev
the final 'TEXINPUTS' path is the three directories:
.:/home/texmf:/home/texmfprev
The '.PROGNAME' suffix on variables and '_PROGNAME' on environment
variable names are not implemented for general variable expansions.
These are only recognized when search paths are initialized (⇒Path
sources).
Variable expansion is implemented in the source file
'kpathsea/variable.c'.