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 :&
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access