GNU Info

Info Node: (zsh.info)Modifiers

(zsh.info)Modifiers


Prev: Word Designators Up: History Expansion
Enter node , (file) or (file)node

Modifiers
---------

After the optional word designator, you can add a sequence of one or
more of the following modifiers, each preceded by a `:'.  These
modifiers also work on the result of _filename generation_ and
_parameter expansion_, except where noted.

h
     Remove a trailing pathname component, leaving the head.  This works
     like `dirname'.

r
     Remove a filename extension of the form `.XXX', leaving the root
     name.

e
     Remove all but the extension.

t
     Remove all leading pathname components, leaving the tail.  This
     works like `basename'.

p
     Print the new command but do not execute it.  Only works with
     history expansion.

q
     Quote the substituted words, escaping further substitutions.  Works
     with history expansion and parameter expansion, though for
     parameters it is only useful if the resulting text is to be
     re-evaluated such as by eval.

Q
     Remove one level of quotes from the substituted words.

x
     Like q, but break into words at whitespace.  Does not work with
     parameter expansion.

l
     Convert the words to all lowercase.

u
     Convert the words to all uppercase.

s/L/R[/]
     Substitute R for L as described below.  Unless preceded
     immediately by a g, with no colon between, the substitution is
     done only for the first string that matches L.  For arrays and for
     filename generation, this applies to each word of the expanded
     text.

&
     Repeat the previous s substitution.  Like s, may be preceded
     immediately by a g.  In parameter expansion the & must appear
     inside braces, and in filename generation it must be quoted with a
     backslash.

The s/l/r/ substitution works as follows.  The left-hand side of
substitutions are not regular expressions, but character strings.  Any
character can be used as the delimiter in place of `/'.  A backslash
quotes the delimiter character.  The character `&', in the
right-hand-side R, is replaced by the text from the left-hand-side L.
The `&' can be quoted with a backslash.  A null L uses the previous
string either from the previous L or from the contextual scan string S
from `!?S'.  You can omit the rightmost delimiter if a newline
immediately follows R; the rightmost `?' in a context scan can
similarly be omitted.  Note the same record of the last L and R is
maintained across all forms of expansion.

The following f, F, w and W modifiers work only with parameter
expansion and filename generation.  They are listed here to provide a
single point of reference for all modifiers.

f
     Repeats the immediately (without a colon) following modifier until
     the resulting word doesn't change any more.

F:EXPR:
     Like f, but repeats only N times if the expression EXPR evaluates
     to N.  Any character can be used instead of the `:'; if `(', `[',
     or `{' is used as the opening delimiter, the closing delimiter
     should be ')', `]', or `}', respectively.

w
     Makes the immediately following modifier work on each word in the
     string.

W:SEP:
     Like w but words are considered to be the parts of the string that
     are separated by SEP. Any character can be used instead of the
     `:'; opening parentheses are handled specially, see above.


automatically generated by info2www version 1.2.2.9