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

Re: Setting GLOB_DOTS for a single command



Answering not the question in the subject, but the question in the
attempted approach:

On Sat, Nov 20, 2021 at 8:47 PM Zach Riggle <zachriggle@xxxxxxxxx> wrote:
>
> I expect that there's something I can do for scripts that I fully control, to declare some function ('globdots') which is invoked with noglob, and can then internally set the flag, and then trigger expansion of each argument in "$@".
>
> However, I'm not sure what portion of Section 14 (Expansion) to read to figure out how that works.

Since $@ is a parameter (one form of the array of all positional
parameters) you want to look at 14.3 Parameter Expansion.  In
particular

As has been explained already, that's not necessary for globdots.
However, for various reasons, I prefer not to have extendedglob set
all the time, so I have this in my startup:

eglob() {
    setopt localoptions extendedglob
    local c=$1
    shift
    $c $~*
}
alias eglob="noglob eglob "




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