Event Modifiers
Following a word designator (or an event specifier if there is no designator) you can add an event modifier:
!event
:words
:modifiers
!event
:modifiers
Modifiers change the way an event is treated. If you add :p
to an event reference, the event is printed (echoed) but not executed. Other modifiers change the text of the recalled event or words in some way. For instance, adding :s/a/b
changes a
to b
in the command line. This feature is useful for fixing mistakes or modifying an argument. Possible modifiers are listed in Table 6-5.
Table 6-5. History Reference Modifiers
Modifier | Description |
---|---|
| Print resulting command without executing it |
| Perform substitution, replacing |
| Repeat previous |
| Root of filename (everything but extension following dot) |
| Extension of filename (suffix following dot) |
| Head of pathname (all but last component) |
| Tail of pathname (last component) |
| Quote words (prevents filename pattern expansion) |
| Like |
| Make first lowercase letter uppercase (tcsh only) |
| Make first uppercase letter lowercase (tcsh only) |
| Apply modifier following |
| Apply modifier(s) following |
Modifiers vary a great deal in terms of their general usefulness. I find that :s
and :p
are the most valuable. The following sections discuss :p
, the substitution modifier :s
(along with the repetition modifiers :g
, :a
, and :&
Get Using csh & tcsh now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.