csh(1)

csh(1)

These forms, without further modi®cation, simply reintroduce the words of the speci®ed events, each separated by a single blank. As a special case, !! is a re-do; it refers to the previous command.

To select words from a command, use a colon (:) and a designator for the desired words after the event speci®cation. The words of an input line are numbered from zero. The basic word designators are:

0First word (i.e., the command name itself).

nnth word.

^First argument. (This is equivalent to 1.)

$ Last word.

a-bRange of words from a through b. Special cases are -y, an abbreviation for ``word 0 through word y''; and x-, which means ``word x up to, but not including, word $''.

*Range from the second word through the last word.

%Used with a search sequence to substitute the immediately preceding matching word.

The colon separating the command speci®cation from the word designator can be omitted if the argument selector begins with a Ã, $, *, -, or %.

After word designator can be followed by a sequence of modi®ers, each preceded by a colon. The following modi®ers are de®ned:

hUse only the ®rst component of a path name by removing all following components.

rUse the root ®le name by removing any trailing suf®x (.xxx).

eUse the ®le name's trailing suf®x (.xxx) by removing the root name.

s /l/r

substitute the value of r for the value l in the indicated command.

tUse only the ®nal ®le name of a path name by removing all leading path name components.

&Repeat the previous substitution.

pPrint the new command but do not execute it.

qQuote the substituted words, preventing further substitutions.

xLike q, but break into words at blanks, tabs and newlines.

gUse a global command as a pre®x to another modi®er to cause the speci®ed change to be made globally. All words in the command are changed, one change per word, and each string enclosed in single quotes (') or double quotes ( " ) is treated as a single word.

Unless preceded by a g, the modi®cation is applied only to the ®rst modi®able word. An error results if a substitution is attempted and cannot be completed (i.e., if you ask for a substitution of !11 on a history buffer containing only 10 commands).

The left hand side of substitutions are strings; not regular expressions in the sense of HP-UXeditors. Any character can be used as the delimiter in place of a slash (/). Use a backslash to quote a delimiter character if it is used in the l or r string. The character & in the right-hand side is replaced by the text from the left.

A\ also quotes &. A null l string uses the previous string either from an l or from a contextual scan string s in !?s?. The trailing delimiter in the substitution can be omitted if a new-line character follows immedi- ately, as may the trailing ? in a contextual scan.

A history reference can be given without an event speci®cation (as in !$). In this case, the reference is to the previous command unless a previous history reference occurred on the same line, in which case this form repeats the previous reference. Thus

!?foo?Ã !$

gives the ®rst and last arguments from the command matching ?foo?.

A special abbreviation of a history reference occurs when the ®rst non-blank character of an input line is a circum¯ex (Ã). This is equivalent to !:sÃ, providing a convenient shorthand for substitutions on the text of the previous line. Thus ÃlbÃlib ®xes the spelling of lib in the previous command.

Finally, a history substitution can be enclosed within curly braces { } if necessary to insulate it from the characters which follow. Thus, after

HP-UX Release 11i: December 2000

− 9 −

Section 1137

c