Aargh

Expansion of Environmental Variables

In some cases, aargh recognizes environmental variables within the XML file, and expands them just as most UNIX shells expand them. For example, when specifying an external file that contains remarks text, your XML might say:
	<Remarks>
		<File name="$inc/gpl_notice.txt"/ >
	</Remarks>
If you have exported an environmental variable named "inc" with the value "/appl/agen/src/inc", then aargh will expand the value of the name attribute to "/appl/agen/src/inc/gpl_notice.txt".

The name of an environmental variable may contain letters, digits, and underscores, but must not begin with a digit. For example, "delta_9" is a valid name, but "delta 9" is not valid because it contains a blank space, and "9_delta" is not valid because it begins with a digit.

When you use the environmental variable, precede the variable name with a dollar sign so that aargh knows to treat it as a variable name rather than as literal text.

You can also enclose the variable name (but not the dollar sign) in curly braces. The curly braces are necessary when you follow the variable with characters that aargh would otherwise treat as part of the name. Using the example above, aargh would expand "${inc}lic/gpl_notice.txt" to "/appl/agen/src/inclic/gpl_notice.txt". Without the curly braces, aargh would look for an environmental variable named "inclic".

Aargh gives special treatment to tildes. If the tilde is the first character in the string to be expanded, and is either the only character or is immediately followed by a slash, then aargh expands it as if it were "$HOME", which in the UNIX or Linux world usually refers to the user's home directory. For example, on my own machine, "~/proj" expands to "/home/jsm/proj".

If you need aargh to treat a dollar sign, tilde, or backslash as literal text, then escape it with a preceding backslash. For example, "/home/root/sys\$opt" will be expanded to "/home/root/sys$opt".

The expansion of environmental variables is not completely compatible with versions of aargh prior to version 1.2.1. Some existing XML files written for aargh may use tildes, dollar signs, or backslashes within file names or paths. In particular, Windows and MSDOS commonly use backslashes to separate directory names within directory paths. With version 1.2.1 and above, aargh will not interpret these character strings as originally intended.

The solution is to escape the offending characters with preceding backslashes as needed. In the case of Windows and MSDOS, another approach is to replace backslashes with forward slashes as directory separators. The forward slashes generally work everywhere but on the command line.


Home