mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-22 16:20:23 +02:00
add print -f option, %n format specifier and tests for print/printf (15973)
This commit is contained in:
parent
0ca8bb74f0
commit
648d1c2756
7 changed files with 250 additions and 91 deletions
|
@ -638,7 +638,8 @@ If the tt(PUSHD_MINUS) option is set, the meanings of `tt(PLUS())' and
|
|||
`tt(-)' in this context are swapped.
|
||||
)
|
||||
findex(print)
|
||||
item(tt(print) [ tt(-bnrslzpNDPoOicm) ] [ tt(-u)var(n) ] [ tt(-R) [ tt(-en) ]] [ var(arg) ... ])(
|
||||
item(tt(print) [ tt(-bnrslzpNDPoOicm) ] [ tt(-u)var(n) ] [ tt(-f) var(format) ] [ tt(-R) [ tt(-en) ]] [ var(arg) ... ])(
|
||||
With the `tt(-f)' option the arguments are printed as described by tt(printf).
|
||||
With no flags or with flag `tt(-)', the arguments are printed on
|
||||
the standard output as described by tt(echo), with the following differences:
|
||||
the escape sequence `tt(\M-)var(x)' metafies the character
|
||||
|
@ -715,19 +716,24 @@ ifnzman(noderef(Prompt Expansion))\
|
|||
).
|
||||
)
|
||||
enditem()
|
||||
|
||||
If any of `tt(-m)', `tt(-o)' or `tt(-O)' are used in combination with
|
||||
`tt(-f)' and there are no arguments (after the removal process in the
|
||||
case of `tt(-m)') then nothing is printed.
|
||||
)
|
||||
findex(printf)
|
||||
item(tt(printf) var(format) [ var(arg) ... ])(
|
||||
Print the arguments according to the format specification. Formatting
|
||||
rules are the same as used in C. The same escape sequences as for tt(echo)
|
||||
are recognised in the format. All C format specifications ending in one of
|
||||
csdiouxXeEfgG are handled. In addition to this, `tt(%b)' can be used
|
||||
csdiouxXeEfgGn are handled. In addition to this, `tt(%b)' can be used
|
||||
instead of `tt(%s)' to cause escape sequences in the argument to be
|
||||
recognised and `tt(%q)' can be used to quote the argument in such a way
|
||||
that allows it to be reused as shell input. With the numeric format
|
||||
specifiers, if the corresponding argument starts with a quote character,
|
||||
the numeric value of the following character is used as the number to
|
||||
print.
|
||||
print. With `tt(%n)', the corresponding argument is taken as an identifier
|
||||
which is created as an integer parameter.
|
||||
|
||||
If arguments remain unused after formatting, the format string is reused
|
||||
until all arguments have been consumed. If more arguments are required by
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue