09.06.2013 Views

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

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.

Programming Commands <strong>XENIX</strong> Programming<br />

csh (continued)<br />

Any of these characters may be placed in parentheses to form a simple command, which<br />

may be a component of a pipeline. It is also possible to separate pipelines with II or &&<br />

indicating, as in the C language, that the second is to be executed only if the first fails<br />

or succeeds, respectively. (See the section on "Expressions" later in this entry.)<br />

Substitutions<br />

The following sections describe the various transformations the shell performs on the<br />

input. It performs substitutions in the order the input demands, not necessarily in the<br />

order presented here.<br />

History Substitutions<br />

History substitutions can be used to reintroduce sequences of words from previous<br />

commands, possibly performing modifications on these words. Thus, history<br />

substitutions provide a generalization of a redo function.<br />

History substitutions begin with the exclamation point character (!) and may begin<br />

anywhere in the input stream if a history substitution is not already in progress. This !<br />

may be preceded by a \ to prevent its special meaning. An ! is passed unchanged when<br />

it is followed by a blank, tab, newline, =, or (. History substitutions also occur when an<br />

input line begins with a caret ("). This special abbreviation will be described later. Any<br />

input line that contains history substitution is echoed on the terminal before it is<br />

executed as it could have been typed without history substitution.<br />

Commands input from the terminal that consist of one or more words are saved on the<br />

history list, the size of which is controlled by the history variable. The previous<br />

command is always retained. Commands are numbered sequentially from 1.<br />

For example, consider the following output from the history command:<br />

9 write michael<br />

10 ex write.c<br />

11 cat oldwrite.c<br />

12 diff *write.c<br />

The commands are shown with their event numbers. It is not usually necessary to use<br />

event numbers, but the current event nu mber can be made part of the prompt by placing<br />

an ! in the prompt string. With the current event 13, we can refer to previous events by<br />

event number !11. We can also refer to them relatively, as in !-2 (which refers to the<br />

same event), by a prefix of a command word, as in !d for event 12 or !w for event 9, or<br />

by a string contained in a word in the command, as in !?mic? (which also refers to event<br />

9). These forms, without further modification, simply reintroduce the words of the<br />

specified events, each separated by a single blank. As a special case, !! refers to the<br />

previous command; thus !! alone is essentially a redo. The form !# references the<br />

current command (the one being typed in). It allows a word to be selected from further<br />

left in the line to avoid retyping a long name, as in !#:1.<br />

B-36

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

Saved successfully!

Ooh no, something went wrong!