|
SECTION 4 IMPORTANT COMMAND LANGUAGE FEATURES Several features of Multics enable you to apply commands to a wide range of segments simultaneously. Thus far we have concentrated on the flexibility with which you can invoke single commands with a limited number of pathnames. In this section we will see how Multics command language enables you to multiply both the commands and the pathnames executed by issuing one command line. It is with these features that you gain truly efficient control over the large quantity of information that Multics allows you to store. STAR NAMES A detailed command like the one constructed in Section 2 can also be applied with precision another way - across a wide range of specified pathnames. One way to do this is by using the star and equals conventions. Many commands that accept pathnames as input allow any component of the final entryname in the path to be a star. This star (*) then represents all names that appear in that position of the pathname, and thus the command will operate on a range of pathnames rather than on just one. The list command will serve well to illustrate this feature. Suppose you store in your working directory a number of segments whose entrynarnes have "plans" as their last component. With these you keep track of all your plans and changes you make in them. To list them all without using the star convention would require you to type each pathname in full:
With the star convention, you can get all of these segments listed with a much shorter command line:
Use of this single asterisk can be expanded to fit a variety of situations like the following (the -no_header control argument is used to eliminate the list header from these examples):
The above sample execution lists all segments with entrynames composed of three components, the first being "seg_1."
The example above lists all segments whose entryname has two components, the second (and last) being "plans."
The above example lists all segments with three-component entrynames. Sometimes occasions arise when you wish to specify part of a component as variable rather than the whole component. Multics provides for this with the question mark (?) feature of the star convention. The question mark represents just one letter of an entryname. Suppose, for instance, that you wish to list all pathnames consisting of one three-letter component.
Suppose then that you want to list all segments in your working directory with two-component entrynames, the second containing the word "plans" followed by exactly one character. In this case you would use a question mark and a star name:
These two features can even be used together in the same component of an entryname. In the following example the command will list all segments with one-component entrynames beginning with "ad" and containing at least three characters:
In this case the question mark and star are used together because the user wants listed only segments whose entrynames have at least three characters. The question mark cannot be interpreted as null, that is, having no corresponding character, so only entrynames with at least one character after "ad" are listed. But the star can be interpreted as null when it is used to represent part of a component, so entrynames with no more than one character after "ad" are listed (e.g., "add"). So too, the above command used without the question mark would list two-character entrynames as well as those with three or more characters:
Yet another feature of the star convention is the double star (**) which matches any number of components (including none) in the corresponding position in the entryname. For instance, the following command line will list all entries in the working directory which have "plans" for the last entryname component.
Notice that this form of the pathname argument will also return an entry whose only component is "plans"; that's because the double star can be interpreted as null. In order to get only "plans" entries with two or more components, you would type:
The single star is added here because it is not interpreted as null when it is used to represent an entire component. Thus, the star name in this command line returns only entrynames with at least two components. The single star can be interpreted as null only when it represents part of an entryname component (e.g., "ad*"), not when it represents an entire component. The double star, on the other hand, can be interpreted as null whenever it is used, though of course there would be no reason to use it for representing anything but one or more complete entryname components. EQUAL NAMES Some commands that accept pairs of pathnames as their arguments (e.g., the rename command described in the MPM Commands) allow any component of the second entryname to be an equal sign. This equal sign (=) then represents the corresponding component of the first entryname given after the command name. For instance, if a segment named random.data is to be renamed ordered.data, the user would type:
The convenience of this is more significant when several entrynames are being typed. For example, in the following add_name command:
is equivalent to:
The equal name convention (commonly referred to in Multics documentation as the equals convention) becomes extremely useful for matching series of entryname components when it is combined with the star convention. In the following command, all two-component entrynames with data_base as their second component are renamed with data as their second component:
The combination of star with equal name can be extended, as in this case, for example, where you wish to rename all segments whose entrynames have "plans" as their last component. The command:
will append "old_" to each first component of the following entrynames: On the other hand, the above command would not change the following segment names:
because the star name path "*.plans" returns only segments with two-component entrynames whose second component is "plans." Another equal name feature that is comparable to a star name feature is the double equal sign. Like the double star, the double equal represents more than one entryname component, as in the following command:
is equivalent to:
In this example the double equal sign stands for all components following the first component, in this case two components, "two" and "three." In the example that follows, the entryname using an equal name contains more components than the matching entryname. Thus the double equal sign does not correspond to any components of the matching entryname and it is ignored. The commands:
are equivalent to:
Like the double star, the double equal sign can be interpreted as null. In this example, only the specified components of the matching entrynames, "x" and "y", are used because two are enough to match the initial entryname, "alpha.beta." There is a difference between the way single and double equal signs are interpreted when they have no corresponding component. When a single equal sign appears in a position where no corresponding entryname component exists, Multics responds with an error message, such as in the following:
Unlike the double equal sign, the single equal sign cannot be interpreted as null. This usage is, therefore, illegal because there is no second component in the entryname "alpha" with which to match the equal name component. But with a double equal sign the command would function because this sign can represent any number of components, including none, as is the case in the three examples above where "alpha. beta" is renamed "x.y." Finally there is the triple equal sign feature of the equals convention. The triple equal sign component represents all components of the corresponding entryname and thus no other component of the equal name may contain an equal sign. The triple equal sign is used to add components to a name, as in the following:
which is equivalent to:
There is one last aspect of the equals convention to discuss, though you may not use it very often. It is the percent sign (%), and it is similar to the question mark in the star convention. The percent sign (%) represents a single character in a specific position in the corresponding entryname component. For instance, the command:
renames all two-component entrynames that have a last component of data and a first component containing three or more characters so that the first component is truncated to the first three characters and the second component is data (e.g., alpha.data would be renamed alp.data). CONCATENATION Yet another feature of Multics command language is concatenation, the practice of joining separate character strings together to form one string. When a character string bounded by reserved characters (often called a delimited element) is placed next to a string or another delimited element in a command line, the two are concatenated. You can thus form character strings by concatenating elements such as parenthetical expressions, active functions, and quoted strings. If, for instance, while working in another directory you wish to rename a segment in your home directory, you could concatenate the home_dir active function with the pathname arguments of the rename command to economically invoke the command:
The home_dir active function would return the character string name of your home directory (e.g., >udd>Pubs>Smith). The command line shown here would thus change:
to:
HOW COMMANDS CAN BE INTERRUPTED Often it is desirable to interrupt a command before its execution is complete. You may discover while the command is executing that a mistake has been made, or it may simply not be necessary to execute the command entirely. For example, you may issue the print command but not need to see the entire segment printed. So as soon as the needed information is printed, you could issue a quit signal. The quit signal's key varies from terminal to terminal; it may be either BREAK, BRK, INTERRUPT, INTRPT, or ATTN. The quit signal causes Multics to stop whatever it is doing and instead print QUIT and a ready message. The ready message printed after a quit signal is slightly different from other ready messages because it contains additional information after the standard numbers:
The character string "level 2" indicates that a new command level has been established and the interrupted work is being held on the previous level. Since the system is at command level, that is, ready to accept more commands, you can either continue the interrupted work or go on to something else. If the work interrupted by the quit signal is to be continued, you can issue either the start (sr) or the program_interrupt (pi) command. The start command resumes execution of the interrupted command from the point of interruption, and the program_interrupt command resumes execution of the original command from a known, predetermined reentry point. Usually the program_interrupt command is invoked when you are working in a subsystem like qedx or read_mail and you want to interrupt printing and remain in the subsystem. This method of resuming an interrupted command is useful for skipping over information not needed at the time. After the QUIT message is printed, typing the program_interrupt command will return you to request level. If, on the other hand, you do not wish to continue the interrupted work, the interrupted command should be released before any other commands are issued. It is expensive to hold interrupted commands at a command level. The release command (rl) releases the work interrupted and held by the quit signal and returns the system to the previous command level (and drops the level information from the ready message).
<< Previous Section Next Section >> Contents | 1 | 2 | 3 | 4 | 5 | 6 | 7 | A | B | C
|