Rit version 1.3 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.aichi-u.ac.jp/pegasus/eman-2.1/ or if you want Japanese manual: http://plan9.aichi-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: ${date} 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: ${date} continues nest line ${date}$ continues same line. Example 2 variable A dollar followed by alpha or numeric User: $user This is equivalent to User: ${echo -n $user} 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: ${pwd}$ is current working directory. ${pwd}$$ this line stays in $${pwd}$$ line. Example 4 multi-lines Rit has full functionality with rc. For example Rit allows multi-line script: ${book='Alice in Wonder Land'}$ ${echo -n 'echo test of multi-line: line1: Carrol''s book: line2: '$book' line3: and we can use { and } in rc strings' } Back slash new line escape in Rc command will work: ${echo -n one\ two } Example 5 'if' statement We have 'if' statement: ${ if(~ $user arisawa) echo ARISAWA if not echo NOT }$ Example 6 braces in Rc Switch statement. Note that { } is included in this example. ${switch($user){ case arisawa echo ARISAWA case * echo NOT }}$ Example 7 comment in Rc command Comment continues up to NL as Rc does. ${# This is a comment up to NL } this is also a part of comment # this is also a comment } # invisible ${# comment line1 terminated by Rc NL escape\ comment line2 } # invisible $${# This isn't a comment but a part of text } Example 8 $0 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: one dollar is simply discarded. $$$$home is equivalent to ${echo -n '$$$home'} $$$${not a rc script} $$$$ is not a NL escape. Note on termination ${echo exit 'some message'>[1=2];exit} will terminate Rit. Rc function "quit" is predefined in Rit: fn quit {echo exit $1 >[1=2];exit} Simple Rc "exit" does not terminate Rit but next ${ } block will terminate Rit because of error. For example ${exit} ${} will terminate Rit.