Re: psychiatric help
Bart Schaefer <[email protected]> Mon, 6 Apr 2026 15:08:53 -0700
| Newsgroups | gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <CAH+w=7YjWKN39Ha7saEu1BHbHjH2gr0wka3ML4fpqy9TM7qv2A@mail.gmail.com> |
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, but then the whole thing is in quotes which means among other things not to glob. 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 > _execute_output="$( eval "$~@" )" # Save output to an array variable. Again, "eval" is doing all the work here and the ~ isn't helping. > > Another problem is that what we're calling 3a is constantly changing. > Wouldn't it be whatever command it about to be executed? During processing of a function body, everything in that body is at some point a command about to be executed. foo() { # Before foo starts, 3a might be what you want setopt localoptions extendedglob # Oops, new 3a args_of_foo=( $@ ) # 3a just changed again # and so on } How do you tell the shell when to "grab" 3a? > eval "$~@" > > ... without the eval You probably mean output=$( ${(e)~@} ) that is -- remove the quotes to allow expansion -- (e) to expand embedded $var -- tilde to enable globbing Or maybe you don't want the (e), I have no idea what $@ values are at this point.