Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: print -C and terminators
- X-seq: zsh-workers 47894
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>, Beverly Pope <countryone77@xxxxxxxxx>
- Subject: Re: print -C and terminators
- Date: Sun, 31 Jan 2021 09:36:05 +0000
- Archived-at: <https://zsh.org/workers/47894>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2021-01/20210131093605.kusgjbaezp3foxbc%40chazelas.org>
- In-reply-to: <CAH+w=7ZPLDMUOSRTh1BkiRomrW04mr7pYnfSfeQ62bxY8_LmLg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>, Beverly Pope <countryone77@xxxxxxxxx>
- References: <d611ab66-c6f9-655f-89dc-ded8697fe0ed@eastlink.ca> <CAN=4vMp+JykOWEYQ5qO495-hOpQXh+4RN6iHcYTP-APg8XHESQ@mail.gmail.com> <CAH+w=7bN7miEudLZcLknDQH3im=u8CCe_3GUqtEJMtyidV8bUg@mail.gmail.com> <CAN=4vMop86hkyYMaBkF-tJaVRaN5Z28gJLqL9tSdy-uy1DNMgg@mail.gmail.com> <0421713D-25C5-477A-90AD-C0BD2B40EED2@gmail.com> <CAH+w=7atW1ArhSO0QLux_XxXR4NBmytZwZ5b79j-2CSv+Tajpg@mail.gmail.com> <CAN=4vMpMJ7nj0d5moqOxmQ2i0uMbu1fwH=FCzT7XsV6hB2UUMQ@mail.gmail.com> <CAH+w=7ZPLDMUOSRTh1BkiRomrW04mr7pYnfSfeQ62bxY8_LmLg@mail.gmail.com>
2021-01-30 17:08:21 -0800, Bart Schaefer:
> On Sat, Jan 30, 2021 at 2:47 PM Roman Perepelitsa
> <roman.perepelitsa@xxxxxxxxx> wrote:
> >
> > I learned about it from the documentation for print:
>
> The paragraph about the "-l" option seems like an odd place for the
> only mention of this, but the zsh doc is like that a lot.
>
> > I don't think I ever wrote or saw code where -l is correct and -C1 is wrong.
>
> With the exception of those doc examples, I don't think I ever saw or
> wrote code where the argument to -C was less than two (unless it was a
> variable). Oh, well.
[...]
I have always been annoyed at that behaviour of print -rl -
outputting an empty line when not being given any argument (and
print -f '%s\n' -- has the same problem).
Until I saw someone on unix.stackexchange.com use print -rC1 --
which addresses the problem. I was the one suggesting it be more
explicitly documented at
https://www.zsh.org/mla/workers/2019/msg01202.html
Since then, I've replaced all my (broken) usages of print -rl
with print -rC1.
I agree it wouldn't harm to also clarify in the -C documentation
that nothing is output if no argument is given.
This:
~$ print -raC2 a b c | sed -n l
a b $
c $
(
~$ print -rC2 a b c | sed -n l
a c$
b$
)
could also be improved.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author