Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: print -C and terminators



On Sat, Jan 30, 2021 at 7:52 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Sat, Jan 30, 2021 at 7:00 AM Beverly Pope <countryone77@xxxxxxxxx> wrote:
> >
> > On Jan 30, 2021, at 4:50 AM, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
> >
> > >  print -rC1 --
> > >
> > > This command doesn't print anything.
> >
> > % print -rC1 -- no_such_file(N)
>
> This behavior seems like a bug to me.  Neither -n nor -N were
> specified, so "print" should always output at least a newline.
> However, it's been around for quite some time and obviously some
> people know about it, so I suppose it should just be documented.

I learned about it from the documentation for print:

  -l  Print the arguments separated by newlines instead of spa-
      ces.  Note: if the list of arguments is empty,  print  -l
      will  still  output  one  empty  line.  To print a possi-
      bly-empty list of arguments one per line, use print  -C1,
      as in `print -rC1 -- "$list[@]"'.

I don't think I ever wrote or saw code where -l is correct and -C1 is wrong.

Roman.




Messages sorted by: Reverse Date, Date, Thread, Author