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

Re: why is eval needed?




On 2022-11-19 08:48, Stephane Chazelas wrote:
And you're calling tree with only one "-L 2" argument while you
want to call it with 2 arguments: -L and 2.

Right, that's what I figured out.  The hard part is 'seeing' these invisible boundaries.  But I'm pleased with myself that I did sort it out.

Clinton:

Another option is

    local level='-L 2'

    tree $=level


Word splitting level gives the results you want

    Excellent.  Yes, that's understandable.  Main thing is to realize that 'tree' want's two arguments there, not the intuitive single argument.

Roman:


You can do the reverse transformation--from array to scalar--like this:

    local array=(...)
    local scalar=${(@q)array}


... Finally I see a use of '(q)' that makes sense to me.





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