Rc shell

del.icio.us del.icio.us
Digg Digg
Furl Furl
Reddit Reddit
Rojo Rojo
Add to OnlyWire
rc
Developed by Bell Labs
Initial release 1989
OS Version 10 Unix, Plan 9, Inferno, Plan 9 from User Space
Type Operating system shell
Paradigm imperative, pipeline
Appeared in 1989
Designed by Tom Duff
Developer Bell Labs
Typing discipline weak
Influenced by Bourne shell
Influenced Es shell
OS Cross-platform
Website 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
fi

is expressed in rc as

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){
        # ...
    }
}

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


This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.


Giant Panda

Mercedes Car
James Bond Guide
This site monitored by SitePinger.net