Jump to content

RUNCOM

From Wikipedia, the free encyclopedia

RUNCOM is a CTSS macro command (script) processor.[1]

History

[edit]

Louis Pouzin created RUNCOM for CTSS circa 1963.[2] He released a paper in 1965 describing a design for the Multics shell which includes a brief description of RUNCOM[3] followed by a second paper he released five days later describing a design for RUNCOM that added commands for control flow, conditional branching and looping.[4]

In the context of Unix-like systems, the term rc stands for the phrase "run commands". It is used for any file that contains startup information for a command.

From Brian Kernighan and Dennis Ritchie:[5]

There was a facility that would execute a bunch of commands stored in a file; it was called runcom for "run commands", and the file began to be called "a runcom". rc in Unix is a fossil from that usage.

Tom Van Vleck, a Multics engineer, has also reminisced about the extension rc: "The idea of having the command processing shell be an ordinary slave program came from the Multics design, and a predecessor program on CTSS by Louis Pouzin called RUNCOM, the source of the '.rc' suffix on some Unix configuration files."[6]

This is also the origin of the name of the Plan 9 from Bell Labs shell by Tom Duff, the rc shell. It is called "rc" because the main job of a shell is to "run commands".

While not historically precise, rc may also be expanded as "run control", because an rc file controls how a program runs. For instance, the editor Vim looks for and reads the contents of the .vimrc file to determine its initial configuration. In The Art of Unix Programming, Eric S. Raymond consistently refers to rc files as "run-control" files.

Usage

[edit]

Background

RUNCOM is not a shell in the sense of the UNIX shell. When a user type commands into CTSS they go to the supervisor (kernel), not any UNIX-shell-like program. Users cannot type commands into RUNCOM, it processes disk files. CTSS files have first name and a second name separated by spaces, e.g. FOO BCD.

Description of RUNCOM

RUNCOM command chains also known as macro-commands (both terms mean scripts) are files with a second name of either RUNCOM or BCD which contain zero or more lines. Lines in the script are either blank lines, comments, regular commands (the kind that could be entered on the supervisor's command line) or the pseudo-command (command built into RUNCOM only) CHAIN.

Comments start with either $ or * as the first character of the line. Comments using $ are printed (including the $) when RUNCOM runs while ones with * are not printed at all. Parameter substitution does not occur in comments.

When a user invoke RUNCOM, the arguments (parameters) to it must first start with the first name of the file containing the script. If a user invoke RUNCOM without any arguments it prints some instructions on how to use it and stops, returning the user to the supervisor's (system's) command line. The remaining arguments, if any, are either command names, values to be used as arguments in the script or the strings (NIL) or (END) including the parenthesis.

In the script, CHAIN give names to arguments which were used on the command line when RUNCOM was called, e.g. putting CHAIN LALA FAFA in the script and invoking RUNCOM XYZZY 3 will cause LALA in the script to be substituted into a 3 when it is used in any lines that come after CHAIN while FAFA will remain FAFA as RUNCOM was invoked without specifying anything for it.

If an argument to RUNCOM is (NIL), a positional parameter denoted as an argument to CHAIN in the script will be expand into nothing, e.g. CHAIN ALPHA BETA GAMMA combined with RUNCOM A (NIL) B will cause ALPHA to be substituted with A and GAMMA to B while BETA will be removed from any command that follows CHAIN in the script.

If a RUNCOM argument is (END) the corresponding CHAIN argument will be treated as (NIL) and all subsequent arguments will also be treated as (NIL).

Any parameter to CHAIN can be used as a command name in the script, i.e. can come first before any arguments. An example would be RUNCOM SCRIPT LISTF combined with CHAIN CMD followed by CMD at the start of a following line. CMD will be substituted into LISTF which will list the files in the directory (like the Unix ls command).

Once the substitutions have been completed, RUNCOM sends the commands to the SCHAIN library subroutine which is available to other programs as well.[1]

See also

[edit]

References

[edit]
  1. ^ a b Grisman, P.A., ed. (1969). The Compatible Time-Sharing System - A Programmer's Guide, 2nd Ed. Boston: The MIT Press. p. 525.
  2. ^ Pouzin, Louis (25 November 2000). "The Origin of the Shell". Multicians. Retrieved 31 July 2017.
  3. ^ Pouzin, Louis (April 2, 1965). The SHELL: A Global Tool for Calling and Chaining Procedures in the System (PDF) (Report). Massachusetts Project Institute of Technology Project MAC. MDN-4. Retrieved April 9, 2022.
  4. ^ Pouzin, Louis (April 7, 1965). RUNCOM - A Macro-Procedure Processor for the 636 System (PDF) (Report). Massachusetts Project Institute of Technology Project MAC. MDN-4. Retrieved April 9, 2022.
  5. ^ "In Unix, what do some obscurely named commands stand for?". IT Knowledge Base. Indiana University. Retrieved 2009-04-20.
  6. ^ "Unix and Multics". Retrieved 2009-04-20.