SECTION 2

MULTICS COMMAND LANGUAGE

A command is, as the name implies, a directive that you the user give the Multics system to make the system perform some action. You issue a command by typing its name at the terminal, along with arguments and control arguments, and concluding with a newline, a combination of a carriage return and linefeed. This sends the particular command message, or command invocation, to the command processor where it is evaluated and acted upon. If in evaluation the command processor finds that the line is improperly typed (which, in most cases, means misspelled), or if the command program finds that the line is incorrectly structured with arguments and control arguments, an error message is returned, indicating where the mistake is:

tmpD4-1.gif

tmpD4-2.gif

The command processor return the error message in the first example because it cannot locate a command with the misspelled name. In the second example, the command processor can find the command named "print," but the command program cannot find a segment whose pathname is "3." Thus the command cannot execute and so returns the error message. The print command will print part of a segment when line numbers are specified (e.g., 3 12); but in this case, the line designation comes incorrectly before the pathname of the segment to be printed. The correct syntax is:

! print report 3 12

When the processor and the command program find that all is well with the command invocation (which, by the way, is referred to simply as a command line throughout most of Multics documentation) , then the command is executed. Finding that the invocation is correct means that the command processor was able to locate a program referred to by the command name given and that the command is capable of running on the arguments and control arguments given.

SYSTEM AND USER-WRITTEN COMMANDS

Most command programs in Multics are available throughout the entire system and can be executed by any user. There are, though, a few commands that can be used only by the system administrator, commands that control system usage, such as those needed to put new users on the system.

Then too, you the user can write special commands, normally called user-written commands, that can be executed in the same manner as system commands, though only by the user who creates them and anyone given access to them.

COMMANDS APPLIED

There is quite a large number of commands on the Multics system and these commands can be applied to a variety of situations. Most commands are adapted to particular situations by using arguments and control arguments, as is discussed in Part 1. Some commands can operate by themselves, that is, without any arguments specified by the user. Commands of this type may not accept arguments, such as the command that prints the current working directory (print_wdir), or they may operate with certain preestablished arguments, default arguments, unless the user specifies otherwise . A good example of the latter is the help command discussed in Part I. Invoked without any control arguments, the help command prints information explaining how to use the help command. Then of course with the name of an info segment given as an argument, the help command will print the explanation contained in that info segment.

Another such command is list (ls) , and it serves as a good example of how a command can be adapted to particular situations. When invoked without any pathname or control arguments, the list command prints the names of all segments in your working directory. For example:

tmpD4-3.gif

If, however, you only need to know how many segments exist in your working directory and how long they are, you can specify that the command return just the total shown in the heading by using the control argument -total (-tt):

tmpD4-4.gif

You can make this command return even more specific information by adding the pathname of a particular segment. You could, for instance, check the length of a particular segment by typing:

tmpD4-5.gif

You could also limit the amount of information printed about the segment. Suppose that the segment is known by several different names and you want to know only the names of the segment. By adding the -name control argument, you can get a list of the heading and the names without the access listing:

tmpD4-6.gif

Using this control argument can save processing time when you are listing names of a lot of segments, as you can do quite easily with the star convention discussed in Section 4.

In yet another case, you could check the last time the segment was altered by adding the date_time_contents_modified control argument (-dtcm):

tmpD4-7.gif

The time of day is represented here in terms of the 24-hour clock; 1456.3 is 2:56 p.m. Knowing when a segment was last changed can be helpful in a variety of ways, such as keeping track of updates to the segment.

In most cases, especially when checking a specific segment, you don't need the header information, so that can be eliminated by typing is another control argument:

tmpD4-8.gif

Control arguments give you a great of deal control over how comments execute. Normally control arguments follow pathname arguments on the command line, though most commands don't require that you arrange the control arguments in any particular order. For instance, the three control arguments in the above command line could be arranged in any order after the pathname. And as is demonstrated below, control arguments can themselves take arguments that further specify how a particular command is to execute.

MULTIPLE COMMANDS

Sometimes it is easier to send several commands to the command processor at one time rather than send them separately. To do this you simply place a semicolon at the end of each command, after its arguments:

! print_messages; print_wdir; who; help sked

Note: There is no need to type a semicolon after the last command and its arguments

If you were to send the commands separately, as we've been doing in examples up to this point, you would have to wait for the command to process and for another ready message to be printed before typing the next command line:

tmpD4-9.gif

Note: The three dots between commands and ready messages are meant to represent the output from the commands.

But none of the four commands in this example require that you wait for the others to process; for instance, you needn't see the results of the print_messages command before typing the print_wdir command. So you can send them all to the command processor at the same time.

This technique is also useful when you are invoking commands that don't return information to your terminal. For example, when you change working directories, there is no reason why you couldn't send the next command to the command processor right away:

! change_wdir >udd>Pubs>Jones; print seg_2

It would be slower to type the commands on separate lines because you'd have to wait for another ready message before typing the second command. By putting both commands on the same line you will be ready, when the next ready message appears, to proceed with what you've learned by reading the contents of seg_2.

RESERVED CHARACTERS AND QUOTED STRINGS

The Multics command language reserves some characters to which special significance is attached. The reserved characters are: space, quotation mark ("), semicolon (;), the newline character, the vertical bar (|), parentheses, and brackets ([]). Earlier in this section we discussed special meanings of the semicolon and newline character. Here we will cover some special uses for the blank space and the quotation mark, and you will see the special significance of parentheses when we discuss iteration below. The special uses of brackets and the vertical bar are discussed in Section 3.

The space character is reserved for separating arguments, including command names, on the command line. For that reason character strings cannot contain blank spaces and instead simulate blanks with the underscore character, as is discussed in Section 3 of Part 1.

Quotation marks are reserved for passing other reserved characters to the command processor without the meaning that is normally attached to them.

To illustrate this usage, let's look at an instance in which a space is used to separate two elements in a command line that are not separate arguments. For this example we will use the sort_list command, a rather uncomplicated command (fully described in the Multics WORDPRO Reference Guide) which you may actually come to use quite often. The command's syntax is:

sort_list pathname -sort STR

The pathname is that of a segment which is designed specifically to hold lists, and the -sort control argument indicates how the segment is to be sorted. It does that by using, in the argument position marked by STR, one or more of the names that differentiate elements within the list, such as "lastname" and "firstname."

Now, assume that you have a segment in your directory that contains a list of customers' names and you want to sort that list by last name and first name. For instance, if you had both John Doe and Jane Doe in your list, you would want Jane placed before John in the alphabetically sorted list. In this case you must include both "lastname" and "firstname" in the argument to the -sort control argument. So, you might type:

! sort_list customers -sort lastname firstname

where "customers" is the pathname of the segment containing your list of customers.

But this invocation would return the error message:

sort_list: Specified control argument is not implemented by this command. firstname

because you are using a space between "lastname" and "firstname." Since the character string following the control argument is an argument in its own right, the space between "-sort" and "lastname" operates legitimately to separate the two. And when the command processor encounters the space between "lastname" and "firstname," it interprets "firstname" to be another argument. But the -sort control argument, takes only one argument, so the presence of what appears to be a second causes an error message to be returned.

In order to suppress the normal meaning of the space character here, and thereby make the two separate character strings appear as one argument, you must enclose the argument to the control argument in quotation marks:

! sort_list customers -sort "lastname firstname"

ITERATION

Iteration is one of several methods Multics provides for economizing typing of the command line. By enclosing elements of a command line in parentheses, you can have each of the elements processed separately. This enables a user to change one or more of the elements used in processing a command. For instance, if you wanted to print three segments with the print command you might type:

! print seg_1; print seg_2; print seg_3

But with iteration you could simply type the command once and then enclose the three segment pathnames in parentheses:

! print (seg_1 seg_2 seg_3)

Parentheses used in this fashion on Multics indicate that the individual items separated by blank spaces within the parentheses are to be processed separately by the command. With the command line used here, the segments would be printed one after another, starting at the left.

Iteration can also be used with command names. If you wish to invoke two commands on the same segment, you would type:

! (print delete) seg_1

In effect, this command line is:

! print seg_1; delete seg_1

such a case, each element from one iterated set is processed with a corresponding element from another set. For example:

! rename >Smith_dir>(Jones Brown Doe) (Day White Green)

expands into:

rename >Smith_dir>Jones Day

rename >Smith_dir>Brown White

rename >Smith_dir>Doe Green

Iterated sets may also be nested, that is, placed one with the other. This practice is particularly useful when subsets of an element are repeated. Parentheses are evaluated from left to right, For example:

! create_dir >Smith_dir>( new>( first second) old>third)

creates three directories:

>Smith_dir>new>first

>Smith_dir>new>second

>Smith_dir>old>third

The directory names "first" and "second" are nested within the iteration composed of the two elements "new" and "old>third." The directory name "new" is added to ">Smith_dir>" first along with one of the elements from the nested iteration - "first." Since there is a nested iteration attached to "new," it is called a second time with the other element from the nested iteration - "second." Then the second element in the outer iteration - "old>third" - is added to the directory name ">Smith_dir>."

It is important to note here that there must be a blank space between separate elements in an iteration (e.g., "first" and "second") because they are separate arguments on the command line.

We have now developed some fairly detailed command techniques that demonstrate how precise Multics commands can be when applied with arguments and control arguments. In subsequent sections we will look at still more ways of specifying the manner in which Multics commands are to be run.

 

<< Previous Section                                          Next Section >>

Contents | 1 | 2 | 3 | 4 | 5 | 6 | 7 | A | B | C