Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: The ~ parameter expansion flag: bug or misunderstanding
On Sep 3, 4:14pm, Peter Stephenson wrote:
}
} The documentation isn't very clear
While we're sort of on the subject, the (l) and (r) padding flags say:
The arguments :STRING1: and :STRING2: are optional; neither, the
first, or both may be given. Note that the same pairs of
delimiters must be used for each of the three arguments. The
space to the left will be filled with STRING1 (concatenated as
often as needed) or spaces if STRING1 is not given. If both
STRING1 and STRING2 are given, string2 is inserted once directly
to the left of each word, truncated if necessary, before STRING1
is used to produce any remaining padding.
What this doesn't say is that if STRING2 is the empty string, a space
is inserted instead:
torch% f=f
torch% print X${(l:2::.:)f}X
X.fX
torch% print X${(l:2::.:::)f}X
X fX
torch% print X${(l:5::.:::)f}X
X... fX
torch% print X${(l:5::.::+:)f}X
X...+fX
I'm not sure if that's a bug, or intentional. Of course one might ask
why one would bother with the empty :: when it could simply be left out.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author