@float Table,Table:mask-template-characters
@table @code
@dbtitle{Mask Template Characters}
@item %%
@cindex mask template character, @samp{%}
Produces a literal @samp{%}-sign.

@item %i
@cindex mask template character, @samp{i}
Expands to the index of the mask file starting at zero.

@samp{%i} supports setting a pad character or a width specification:

@display
@code{%} @var{PAD} @var{WIDTH} @code{i}
@end display

@var{PAD} is either @samp{0} or any punctuation character; the default
pad character is @samp{0}.  @var{WIDTH} is an integer specifying the
minimum width of the number.  The default is the smallest width given
the number of input images, this is 1 for 2--9 images, 2 for 10--99
images, 3 for 100--999 images, and so on.

Examples: @samp{%i}, @samp{%02i}, or @samp{%_4i}.

@item %n
@cindex mask template character, @samp{n}
Expands to the number of the mask file starting at one.  Otherwise it
behaves identically to @samp{%i}, including pad character and width
specification.

@item %p
@cindex mask template character, @samp{p}
This is the full name (path, filename, and extension) of the input
file associated with the mask.

Example: If the input file is called
@file{/home/@/luser/@/snap/@/img.jpg}, @samp{%p} expands to
@file{/home/@/luser/@/snap/@/img.jpg}, or shorter: @samp{%p} @result{}
@file{/home/@/luser/@/snap/@/img.jpg}.

@item %P
@cindex mask template character, @samp{P}
This is the full name of the output file.

@item %d
@cindex mask template character, @samp{d}
Is replaced with the directory part of the associated input file.
@ifhtml
See Info file @file{coreutils.info}, node ``dirname invocation''.
@end ifhtml
@ifnothtml
@inforef{dirname invocation, Stripping a non-directory suffix from a
file name, coreutils.info}.
@end ifnothtml

Example (cont.): @samp{%d} @result{} @file{/home/@/luser/@/snap}.

@item %D
@cindex mask template character, @samp{D}
Is replaced with the directory part of the output file.

@item %b
@cindex mask template character, @samp{b}
Is replaced with the non-directory part (often called ``basename'') of
the associated input file.
@ifhtml
See Info file @file{coreutils.info}, node ``basename invocation''.
@end ifhtml
@ifnothtml
@inforef{basename invocation, Stripping a directory and suffix from a
file name, coreutils.info}.
@end ifnothtml

Example (cont.): @samp{%b} @result{} @file{img.jpg}.

@item %B
@cindex mask template character, @samp{B}
Is replaced with the non-directory part of the output file.

@item %f
@cindex mask template character, @samp{f}
Is replaced with the filename without path and extension of the
associated input file.

Example (cont.): @samp{%f} @result{} @file{img}.

@item %F
@cindex mask template character, @samp{F}
Is replaced with the filename without path and extension of the output
file.

@item %e
@cindex mask template character, @samp{e}
Is replaced with the extension (including the leading dot) of the
associated input file.

Example (cont.): @samp{%e} @result{} @file{.jpg}.

@item %E
@cindex mask template character, @samp{E}
Is replaced with the extension of the output file.
@end table

@caption{Special characters to control the generation of mask filenames.}

@shortcaption{Mask template characters}

@cindex mask template characters, table of
@end float
