rc
{{Expansion depth limit exceeded| left =
| #default = }}
{{Expansion depth limit exceeded| {{{Expansion depth limit exceeded}}}
| [[File:{{Expansion depth limit exceeded| speedy = Ambox speedy deletion.png
| delete = Ambox deletion.png
| content = Ambox content.png
| style = Edit-clear.svg
| move = Ambox move.png
| protection = Ambox protection.png
| notice
| #default = Ambox notice.png
}} | {{Expansion depth limit exceeded| left = 20x20px
| #default = 40x40px
}} |link=|alt=]]
}}{{Expansion depth limit exceeded| left =
| #default = |
{{{Expansion depth limit exceeded}}} |
Expression error: Unrecognized punctuation character "{".
rc is the command line interpreter for Version 10 Unix and Plan 9 from Bell Labs operating systems. It resembles the Bourne shell, but its syntax is somewhat simpler. It was created by Tom Duff, who is better known for an unusual C programming language construct called Duff's device.
A port of the original rc to Unix is part of Plan 9 from User Space. A rewrite of rc for Unix-like operating systems by Byron Rakitzis is also available but includes some incompatible changes.
Rc uses C-like control structures instead of ALGOL-like, as the original Bourne shell uses, except that it uses a construct if not instead of else and has a Bourne-like for loop to iterate over lists. In rc all variables are lists of strings, which eliminates the need for constructs like "$@".
Examples
For example, the Bourne shell script
<source lang="bash"> if test $1 = hello; then
echo hello, world
else
case $2 in
1) echo $# 'hey' "jude's"$3;;
2) echo `date` :$*: :"$@":;;
*) echo why not 1>&2
esac
for i in a b c; do
echo $i
done
fi </source>
is expressed in rc as
<source lang="text"> if(~ $1 hello)
echo hello, world
if not {
switch($2) {
case 1
echo $#* 'hey' 'judes'^$3
case 2
echo `{date} :$"*: :$*:
case *
echo why not >[1=2]
}
for(i in a b c)
echo $i
} </source>
Because if and if not are two different statements, they must be grouped in order to be used in certain situations.
Rc also supports more dynamic piping:
<source lang="text"> a |[2] b # pipe standard error of a to b — in Bourne shell as a 1>&2 | b a <>b # opens b as a's standard input and standard output a <{b} <{c} # becomes a {standard output of b} {standard output of c} </source>
References
External links
- "Rc - The Plan 9 Shell" - by Tom Duff
- Plan 9 rc manual page
- Plan 9 from User Space - Includes rc and other Plan 9 tools for Linux, Mac OS X and other Unix-like systems.
- Byron Rakitzis' rewrite for Unix
- werc - A web document management system implemented completely in the rc shell.
| File:HelloWorld.svg | This programming language-related article is a stub. You can help Wikipedia by expanding it. |
If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...