Rc (Unix shell): Difference between revisions

Content deleted Content added
JustinCB (talk | contribs)
No edit summary
Copyediting and two {{clarification needed}s.
Line 28:
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 the original Bourne shell's [[ALGOL]]-like, as the original Bourne shellstructures, except that it uses an <code>if not</code> construct instead of <code>else</code>, and has a Bourne-like <code>for</code> loop to iterate over lists. In rc, all variables are lists of strings, which eliminates the need for constructs like "<code>[[$@]]</code>".
 
==Influences== <!--Anchor from redirected [es] article; caution with changes. -->
 
===es===
''es'' (for "extensible shell") is an [[open source]], [[command line interpreter]] developed by Rakitzis and Paul Haahr,<ref>{{cite book | url=https://books.google.com/books?id=iEK6eQQwOF0C&pg=PA43&redir_esc=y#v=onepage&q&f=false | title=Spatial Analytical Perspectives on GIS}}</ref> that uses a [[scripting language]] syntacticallysyntax similarinfluenced toby the rc shell.<ref>{{cite web |url=http://manpages.ubuntu.com/manpages/hardy/man1/es.1.html |title=Ubuntu Manpage: es - extensible shell |publisher=Manpages.ubuntu.com |date=1992-03-05 |accessdate=2012-08-24 |deadurl=yes |archiveurl=https://web.archive.org/web/20140224211945/http://manpages.ubuntu.com/manpages/hardy/man1/es.1.html |archivedate=2014-02-24 |df= }}</ref><ref>{{cite web | url=http://foldoc.org/Extensible+Shell |title=Extensible Shell |publisher=FOLDOC |date= |accessdate=2012-08-24}}</ref> It was originally based on code from Byron Rakitzis's clone of [[rc shell|rc]] for Unix<ref>{{cite web | url=http://luv.asn.au/overheads/shells-talk.html |title=Shells Available for Linux |publisher=LUV |date= |accessdate=2012-08-24}}</ref><ref>{{cite web|last=Jones|first=Tim|title=Evolution of shells in Linux|url=http://www.ibm.com/developerworks/library/l-linux-shells/|publisher=IBM|accessdate=14 March 2014}}</ref>
 
Extensible shell is intended to provide a fully [[functional programming|functional]] [[programming language]] as a [[Unix shell]].<ref>{{cite web|url=http://nnc3.com/lj/LJ/LJ12/0062.html|title=Linux Journal 12: What's GNU|date=|accessdate=2012-08-24|deadurl=yes|archiveurl=https://web.archive.org/web/20130117064248/http://nnc3.com/lj/LJ/LJ12/0062.html|archivedate=2013-01-17|df=}}</ref> The bulk of es development occurred in the early 1990s, after the shell was introduced at the Winter 1993 [[USENIX]] conference in [[San Diego]],<ref>[http://stuff.mit.edu/afs/sipb/user/yandros/doc/es-usenix-winter93.html Es: A shell with higher-order functions] by Byron Rakitzis, [[NetApp|NetApp, Inc]], and Paul Haahr, [[Adobe Systems Incorporated]]; <u>Archived</u> at [https://web.archive.org/web/20090415213858/http://192.220.96.201/es/es-usenix-winter93.html Archive.Org].</ref> Official releases appear to have ceased after 0.9-beta-1 in 1997,<ref>[ftp://ftp.sys.utoronto.ca/pub/es/ ]</ref> and standard es lacks features as compared to more popular shells, such as [[zsh]] and [[Bash (Unix shell)|bash]].<ref>{{cite web | url=http://www.faqs.org/faqs/unix-faq/shell/shell-differences/ |title=UNIX shell differences| publisher=Faqs.org |date= | accessdate=2012-08-24}}</ref>
 
==Examples==
For example, theThe Bourne shell script:
 
<source lang="bash">
Line 55:
</source>
 
is expressed in rc as:
 
<source lang="text">
Line 74:
</source>
 
Because <code>if</code> and <code>if not</code> are two different statements, they must be grouped in order to be used in certain situations.{{clarification needed |date=January 2019}}
 
Rc also supports more dynamic piping:
 
a |[2] b ''# pipe only [[standard error stream|standard error]] of a to b — inequivalent [[Bourne shell]] as ato '3>&2 2>&1 >&3 | b' in [[Bourne shell]]''
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}''{{clarification needed |date=January 2019}}
 
==References==