A
shell for
Unix and
Plan 9, written by
Tom Duff then of
Bell Labs.
rc combines extremely simple syntax with the expressivity and fine-grained control of the Bourne shell (sh).
Examples of parallels between Bourne shell and rc follow:
- if w | grep me; then echo "I'm here!"; fi in Bourne becomes
if (w | grep me) echo 'I''m here!' in rc (rc uses C/AWK-like brace-based syntax rather than the keyword-cluttered Algol/Pascal-like syntax of Bourne)
- size = `wc -l \'ls -t|sed 1q\`` in Bourne becomes
size = `{wc -l `{ls -t | sed 1q}} in rc (rc only parses its input once, obviating the need to escape the backquotes with a backslash)
Also, rc has support for nonlinear pipelines via pipeline branching:
cmp <{old} <{new} runs the commands ``old'' and ``new'', comparing their input.
The syntax and semantics of rc have also spawned an offshoot for Unix only at this point, called es (the ``extensible shell'', which has support for many advanced language features like lambda expressions and lexical scoping).