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

Re: psychiatric help





On 2026-04-04 20:57, Bart Schaefer wrote:

If you need to copy $@ (et al.) into another variable, use array syntax:
out=( $@ )
Tried this:

alias tt='noglob _tt'
function _tt ()
{
out=( $@ )                # Bart sez.  Array will preserve hard space, no backslash needed.
_execute 'ls $~out'    # Need tilde here!

foo='ls $~out'            # Literal string! Don't forget tilde, same as above.  Consistent.
_execute $foo            #  Plain vanilla var sends literal string, and 'eval' takes care of it.
}

run:

4 /aWorking/Zsh/Source/Wk 4 % test\ ?

test a
test b

test a
test b

... so that's got it under control.  '_execute' boils down to a call to 'eval' as you suspect but it does a bunch of other stuff as well.  Easy to drop the ball tho, the chain of handoffs can be fuddled at any point.  Gotta get it right, I was making it harder than it is. 80% clarity.

Thank you Sensei.

BTW, polite of 'ls' to make multiline output when input is an array.






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