The UnixShellVariableSubstituter class implements the VariableSubstituter interface and provides an inline variable substitution capability using a simplified Unix Bourne (or GNU bash) shell variable syntax. This syntax recognizes the "$var", "${var}" and "${var?default} sequences as variable references. For example, given the string (variables in bold):
file:$user.home/profiles/$PLATFORM/${cfg?config}.txt
and the variable values:
user.home=/home/bmc PLATFORM=freebsd
a UnixShellVariableSubstituter will produce the result string (substitutions noted in bold):
Notes and Caveatsfile:/home/bmc/profiles/freebsd/config.txt
It's also possible to configure a UnixShellVariableSubstituter to throw a {@link UndefinedVariableException}, rather than substituting a blank, if a variable is undefined and a default value is not specified. See the {@link #setAbortOnUndefinedVariable} method.
@see WindowsCmdVariableSubstituter @see VariableDereferencer @see VariableSubstituter @see java.lang.String @version $Revision$ @author Copyright © 2004-2007 Brian M. Clapper
|
|