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

Re: The elements of enlightenment



On Mon, Dec 5, 2022 at 1:21 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> I have to keep appending to the list for each line, can the 'print -v
> var' method handle that?

     The -v option causes the output to be stored as the value of the
     parameter NAME, instead of printed.  If NAME is an array and the
     format string is reused when consuming arguments then one array
     element will be used for each use of the format string.

So
    typeset -a list
    printf -v list "%s ${red}%s${nrm}" ${(kv)options}
should do what you want.




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