Hamilton LaboratoriesHamilton C shell 2012User guideLanguage reference

Substitution modifiers

Oregon Coast

Substitution modifiers
Previous | Next


See also


Substitution modifiers can be applied to any command, variable or history substitution. Any number in a row can be applied.

Operator Meaning

nth word


Count the number of words


Word number 1, counting from 0


Last word


Word matched by a !?str? history search


nth through mth words


0 through nth words


nth through next-to-last words


nth through last word


1 through last word


Single-quote each word


Substitute str2 for str1 and then reparse into words. Match failures are considered to be errors unless ignoreerrors == 2.


Substitute str2 for str1 but leave it as a single string. Also, failure to match is not considered an error.


Repeat last substitution


Global editing: as a prefix character to any of the other editing operators, it means apply the edit operation everywhere it matches, not just the first occurrence.


Treat each word as a string, break it up into words, then single-quote each word.


Print the substitution but don't execute the statement. (Ignored except in history substitutions.)

:h  :r  :t
:e  :f  :m
:M  :A  :L

Pathname editing operators: head, root, tail, extension, fullpath, mixedpath, fullmixedpath, shortname and longname.

See also

Pathname editing
Variable substitutions
History recall
Command substitution
Tutorial: Editing
Tutorial: Variables
Tutorial: History
Tutorial: Command substitution

Previous | Next

Getting started with Hamilton C shell

Hamilton C shell, as it first wakes up.

Getting started with Hamilton C shell

A first few commands.

You can set the screen colors to your taste.

You can set the screen colors to your taste.