Re: psychiatric help

Ray Andrews <[email protected]> Mon, 6 Apr 2026 15:55:24 -0700
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <[email protected]>

On 2026-04-06 15:08, Bart Schaefer wrote:
> On Mon, Apr 6, 2026 at 2:33 PM Ray Andrews <[email protected]> wrote:
>>       print -rS "$~@" # Easy.  No fuss, no muss, no bother.
> This is wrong for several reasons:
> 1) The ~ isn't helping anything because it means to enable globbing,
It's there experimentally cuz Mark likes it. Didn't seem to do any harm.
> but then the whole thing is in quotes which means among other things
> not to glob.
God, it's confusing.  Have to quote to keep 'file name' from splitting 
but can't glob in quotes.  So many of these gotchas. Anyway it works.  
So much trial and error.  What I do have clear in my head is the need 
for arrays.
> 2) print -S expects a single word, but "$@" is an array any time $# is 2 or more
>
> I think you mean
>    print -rS -- "$*" # one word, history re-parses it
... just when I thought I always liked arrays :(
>>       _execute_output="$( eval "$~@" )"  # Save output to an array variable.
> Again, "eval" is doing all the work here and the ~ isn't helping.
I just threw it in a few days ago to see what happened.
> During processing of a function body, everything in that body is at
> some point a command about to be executed.
Sure, I'd expect to have to grab it as the very first line of the 
function or script.
> How do you tell the shell when to "grab" 3a?
First thing.  I quite understand that it's going to change.
> You probably mean
>    output=$( ${(e)~@} )
> that is
>   -- remove the quotes to allow expansion
>   -- (e) to expand embedded $var
>   -- tilde to enable globbing
Holy cow.  Now we do want the tilde :(  I really want to understand this 
stuff but ...

Anyway, will incorporate your modifications.