msi also allows substitutions to be specified via a separate substitution
file. This substitution file allows the same format as the substitution files
accepted by dbLoadTemplate or subtool.
msi -V -ofile -Idir -Msub -Ssubfile templateNOTE: All parameters are optional and a space is optional between -o, -I, -M, and -S and the associated value. Output is written to stdout unless the -o option is given.
Where:
-V
msi -help
include "file"
substitute "var=value,var=value,..."For example let the command be:
msi templateand file includeFile contain:
first name is ${first} family name is ${family}and template is
substitute "first=Marty,family=Kraimer" include "includeFile" substitute "first=Irma,family=Kraimer" include "includeFile"then the following is written to the output.
first name is Marty family name is Kraimer first name is Irma family name is Kraimer
After reading each set of replacements within braces, the template file is read and macro substitution performed.{var1=value1,var2=value2,...} {var1=value1,var2=value2,...} ...
This is the same as the regular format:pattern {var1,var2,...} {value1,value2,...} {value1,value2,...} pattern {var1,var2,...} {value1,value2,...} {value1,value2,...}
{var1=value1,var2=value2} ...
For the template format, the command line template argument is optional. If it specified it is used, otherwise the file template is used. This format is an extension of the format accepted by dbLoadTemplate. It allows templates to be expanded on the host rather via dbLoadTemplate. The file name may appear inside double quotation marks; these are only required if the name contains any environment variable macros of the form ${MOTOR} which will be expanded before the file is opened.file template { pattern format or regular format }file template { pattern format or regular format }
msi -S substitute templatetemplate is
first name is ${first} family name is ${family}substitute is
{first=Marty,family=Kraimer} {first=Irma,family=Kraimer}The following is written to the output.
first name is Marty family name is Kraimer first name is Irma family name is Kraimer
msi -S pattern templatepattern is
pattern {first,last} {Marty,Kraimer} {Irma,Kraimer}template is the same as in the previous example.
The following is written to the output.
first name is Marty family name is Kraimer first name is Irma family name is Kraimer
xxx.substitutions ismsi -S xxx.substitutions
template is the same as in the previous example..file template { pattern {first,last} {Marty,Kraimer} {Irma,Kraimer} pattern {last,first} {Smith,Bill} {Smith,Mary} } file template { {first=Marty,last=Kraimer} {first=Irma,last=Kraimer} }
The following is written to the output
first name is Marty family name is Kraimer first name is Irma family name is Kraimer first name is Bill last name is Smith first name is Mary last name is Smith first name is Marty family name is Kraimer first name is Irma family name is Kraimer
include "<file name>"
or
substitute "<substitutions>"
substitute "a=\"val\""
a=val
include "myfile" #include file
For items within braces separators may be given between items. A separator is either white space or a comma. White space is any of the following: space, formfeed, newline, carriage return, tab, vertical tab.
Each item within braces can be an alphanumeric token or a quoted string. The characters \" can be used for embedded quotes. The rules for non quoted strings are actually more relaxed but any item that is not an alphanumeric string should be given as a quoted string.
Thus
{a=aa b=bb c="\"cc\""}and
{a=aa,b=bb,c="\"cc\""}and
{ a="aa" b="bb", c="\"cc\"" }are all equivalent.
0 - Success.
1 - Can't open/create file, or other I/O error.
2 - -V option specified and one or more undefined macros were encountered.