Rc


Rc

Infobox Software
name = rc



caption =
developer = Bell Labs
released = 1989
latest_release_version =
latest_release_date =
latest_preview_version =
latest_preview_date =
preview_url =
operating_system = Version 10 Unix, Plan 9, Inferno, Plan 9 from User Space
platform =
language =
status =
genre = Operating system shell
source_model = Open source
license =
website =
Infobox programming language
name =

paradigm = imperative, pipeline
year = 1989
designer = Tom Duff
developer = Bell Labs
latest_release_version =
latest_release_date =
latest_test_version =
latest_test_date =
typing = weak
implementations =
dialects =
influenced_by = Bourne shell
influenced = Es shell
operating_system = Cross-platform
license =
website = [http://cm.bell-labs.com/sys/doc/rc.html Rc - The Plan 9 Shell]

rc is the command line interpreter for Version 10 Unix, Plan 9, and Inferno 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 rewrite of rc for Unix-like operating systems by Byron Rakitzis is also available but includes some incompatible changes. A port of the original rc to Unix is part of Plan 9 from User Space.

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. Rc also supports lists of objects as variables, which eliminates the need for constructs like "$@". For example, the Bourne shell script if test $1 = hello; then echo hello, world else case $2 of 1) echo $# 'hey' "jude's"$3;; 2) echo `date` :$*: :"$@": *) echo why not 1>&2 esac for i in a b c; do # ... done fiis expressed in rc as if(~ $1 hello) echo hello, world if not{ switch($2){ case 1 echo $#* 'hey' 'jude"s'^$3 case 2 echo `{date} :$"*: :$*: case * echo why not > [1=2] for(i in a b c){ # ... } }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: 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}

External links

* [http://cm.bell-labs.com/sys/doc/rc.html "Rc - The Plan 9 Shell"]
* [http://plan9.bell-labs.com/magic/man2html/1/rc Plan 9 rc manual page]
* [http://plan9.us Plan 9 from User Space] - Includes rc and other Plan 9 tools for Linux, OS X and other Unix-like systems.
* [http://www.libra-aries-books.co.uk/software/rc/ Byron Rakitzis' rewrite for Unix]


Wikimedia Foundation. 2010.


We are using cookies for the best presentation of our site. Continuing to use this site, you agree with this.