dx (ver0.5)
目次
2006/08/24
Dx
is developed to be used as a SSI(server side include), however it is designed as a tool to process documents not only of HTML format but also of a generic type of documents.
Dx
processes the documents to replace environment variables with its value and commands with its output as well as NCSA SSI does. However the syntax is much simpler and more powerful than NCSA SSI.
Note: the version is 0.5. This means current version is merely a trial one.
Note: use rit instead. rit is more poweful than dx, more flexible, and easier to learn.
Usage
dx [-s][-e] [file [arg ...]]The result is written to stdout.
Dx
processes stdin unless file is specified. If file is specified, dx has two options:-s
: skip the first line in the file.-e
: stop to process on error.Grammer
Dx processes the following statements in the document.$variable
${commandline}
$[condition]{commandline}
wherevariable
denotes an environment variable,commandline
denotes command line andcondition
denotes a condition to execute a command
The symbol$
is effective only if it is followed by variable name or{
or[
.
Spaces between]
and{
result in error.
{commandline}
is allowed to be written in more than one line, however [condition]
must be written in one line.
Double doller $$
is converted to single $
.
And single doller $
at the end of line restrains new line.
Environment variables
Dx
replaces $variable
with its value if the value exist. If not, $variable
is replaced by null string.Name of environment variable is assumed to be simple,i.e., it is constructed only from alpha, digit and underscore.
Environment variable $0, $1, $2, ...
$0 is executable file that invoked <code>dx<code> $1 the first argument of the file $2 the second argument of the file $3 ...Environment variables are not array like that of
rc
. (This should be improved in future.) therefore if we execute${cmd='ls -l' $cmd}
dx
will say there is no 'ls -l'.