Re: psychiatric help

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

On 2026-04-06 13:17, Bart Schaefer wrote:
> Except that's not all you want to do when you add that ,H thing?
Not really because, logically, I'm taking the monster and just inserting 
the tail where it needs to go:

     _execute "ls [options] $TAIL [seds, perls, rubies, whatever ]"

... the thing is that $TAIL can't be expanded because it could be a 
thousand lines long if my whole disk was to be 'ls'ed and expanded. I 
never want to change the CL in real time.

then, in _execute, one of the things that happens, if ',H' is given, is:

     print -rS "$~@" # Easy.  No fuss, no muss, no bother.

... so the monster is there for recall via up arrow or whatever.  No issues.

... but then of course we do need expansion for actual execution:

     _execute_output="$( eval "$~@" )"  # Save output to an array variable.
     _execute_output=( "${(@f)_execute_output}" )
     print -rl -- $_execute_output

... I save the output to a variable then print it, cuz sometimes I just 
want to save it, not show it.  As usual there's some 
formatting/wrapping/splitting grief, but the above works, tho I'm sure 
it's imperfect.  Breakit, fixit ...
> At the C level, it can.  But "invocation string" in that context is
> the entire post-globbing, post-expansion contents.
Yeah, a C program would naturally have it's args expanded before the 
program itself had time to ... yes, of course, same, same.  But in 
theory you know what I mean.
>> But if I could just sneak a peek at 3a) ...
> Another problem is that what we're calling 3a is constantly changing.
Wouldn't it be whatever command it about to be executed?  Thus only of 
use to that command in real time but that's all it would ever be used 
for.  Just to grab the tail.  Come to that, the function *always* knows 
it's own name anyway -- $0 --, so $TAIL is the only thing that would 
ever be of use.

Just now I'm trying to do this:

eval "$~@"

... without the eval but it's split or joined or arrayed wrong.  It 
wants to work, but there's one of those invisible errors.  Tried ten 
variations but can't get it right.  As usual.