13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The command interpreter 243In the file server.In the command interpreter. Unix takes this approach. Processes that wish to convertwild-card names to ordinary file names start a command interpreter processthat terminates after it performs the conversion.In particular utility processes, like Transfer. The Tops-10 operating system for theDEC PDP-10 takes this approach.Wild cards can be generalized into file-name patterns, which might have ways to indicateindividual-character wild cards, alternation (the ‘‘or’’ operator), and concatenation(the ‘‘place one pattern after the other’’ operator). Such patterns are applied to all the filenames in a given set, typically the current working directory. For example, in the C-shell(one of several Unix command interpreters), one can build complex patterns like this:[0-9A-F]{new,old}?text*This pattern matches any file whose name starts with a hexadecimal digit, continues witheither new or old, followed by any one character, followed by text, followed byanything. This pattern would match, for example, Bold.textfile.History.A user often wants to submit the same command twice in a row,perhaps with some minor changes. For example, the user types mail fred to composeand send a message to Fred, decides in the middle that the message does not lookright, cancels ‘‘mail,’’ then types mail fred to start all over. Similarly, the usermight type mail fred and then decide that Betsy should also get a copy of the message.In this case, the command mail fred betsy might have been more appropriate.It is very common for a complex command to be slightly misspelled. The userwants to fix the mistake and resubmit the command.Under the User Principle, command interpreters should make it easy to refer toprevious commands so they can be resubmitted, possibly with some changes. The devicedriver for the terminal might remember the previous line that was typed. When the usertypes the special ‘‘recall line’’ key, the device driver restores that line as if it were typedagain. Intra-line editing might allow the user to fix any mistakes in the line beforeactivating it with a carriage return. A very similar feature can be built into the terminalsthemselves to relieve the device driver of the complexity needed for this service.The command interpreter can also store a history of previous commands. It can beasked to list those commands and to resubmit any of them, possibly with somemodification. The BSD Unix and VMS command interpreters have a large repertoire ofactions that use a history feature.Command completion.It can be awkward for the user to type the entirename of a program or of a file, especially if the operating system allows long file names.The wild-card facility is a convenient way to avoid typing parts of the file name, but itcan lead to ambiguities. Several files may meet the wild-card specification, but the usermight intend only one of them.A feature pioneered by Tenex and found in Tops-20 and in an alternative commandinterpreter for BSD Unix allows the user to specify as much of a file or programname as desired. When the user types the ‘‘please complete’’ key, the command interpreterfinishes the command or file name. The algorithm used by the command

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!