Rit version 1.2
Rit is a PHP like language that is designed for use in Plan 9.
The name came from "rc in text"
You can examine Rit by processing this text:
rit readme
and compare the output with this file.
You will find Rit manual in my web page:
http://plan9.arichi-u.ac.jp/pegasus/eman-2.1/
or if you want Japanese manual:
http://plan9.arichi-u.ac.jp/pegasus/man-2.1/
-Kenar- (Kenji Arisawa)
E-mail: arisawa@aichi-u.ac.jp
General rules
Dollar '$' is only one special symbol of Rit.
A dollar followed by:
variable
Variable is a sequence of alpha or numeric or '_'.
subset of environment variable.
'{'
Rc script follows. the script continues up to '}'.
The terminator '}' must be out of rc string and out of { .. } nest.
'\n'
NL (new line) escape
Example 1 command execution
A dollar followed by '{':
You can write rc script in curly brace { }
Date: Fri Dec 24 19:31:08 JST 2004
Note that we have redundant empty line after this command;
this comes from two subsequent '\n's:
one from command and one from our this text line.
Avoiding this problem we have:
Fri Dec 24 19:31:08 JST 2004
continues nest line
Fri Dec 24 19:31:08 JST 2004 continues same line.
Example 2 variable
A dollar followed by alpha or numeric
User: arisawa
This is equivalent to
User: arisawa
Example 3 NL escape
A dollar at the end of line is NL escape.
Example: This line has NL escape next line.
Many rc command produce NL at the end
We can avoid redundant NL by putting NL escape:
/usr/arisawa/src/pegasus-2.1/rit
is current working directory.
/usr/arisawa/src/pegasus-2.1/rit this line stays in ${pwd}$$ line.
Example 4 multi-lines
Rit has full functionality with rc.
For example Rit allows multi-line script:
echo test of multi-line:
line1: Carrol's book:
line2: Alice in Wonder Land
line3: and we can use { and } in rc strings
Back slash new line escape in Rc command will work:
one two
Example 5 'if' statement
We have 'if' statement:
ARISAWA
Example 6 braces in Rc
Switch statement.
Note that { } is included in this example.
ARISAWA
Example 7 comment in Rc command
Comment continues up to NL as Rc does.
# invisible
# invisible
${# This isn't a comment but a part of text }
Example 8
readme is special, this is a file name currently processed.
Dollar followed other characters is not a special. i.e.,
$, $#
are shown as it is.
Example 9
Sequence of dollars are processed as follows:
If the sequence is followed by alpha or '{' or '\n'
one dollar is simply discarded:
$$$home is equivalent to $$$home
$$${not a rc script}
$$$
is not a NL escape.
If the sequence is followed by other characters,
they are shown as it is:
$$$$ is shown as four dollars
Note on termination
|