Kenji Arisawa
E-mail: arisawa@aichi-u.ac.jp
Aichi University
Kurozasa 370, Miyoshi-cho
Aichi, Japan

2002/03/19
Powered by Pegasus

dx (ver0.5)

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.

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. where variable denotes an environment variable, commandline denotes command line and condition 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 last 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. ドキュメント内に環境変数 variable が存在すると $variable はその内容に置き換わります。存在しない場合には無視されます。

環境変数名は単純形、即ち、英数字および下線記号からのみ構成されると仮定されています。

環境変数 $0, $1, $2, ...

	$0	dx を起動した時の file
	$1	dx を起動した時の最初の arg
	$2	dx を起動した時の第二の arg
	$3	...

環境変数は現在のところ rc のように配列ではありません。(これは将来改善すべき部分です。) 従って
${cmd='ls -l' $cmd}
を実行しても rc と同様に 'ls -l' なんてないよとエラーになります。
(rc はこの場合、
cmd=(ls -l} $cmd
とします。)