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

Re: Parameter Expansion



On Sun, Aug 13, 2017 at 3:58 PM, Clint Priest <cpriest@xxxxxx> wrote:
> Having trouble getting nested parameter substitution working again, how can
> these two lines be correctly merged into a single line:
>
>     FUNCS=( $SD/autoload/*);
>     FUNCS=${(@)FUNCS:t};

You're mixing globbing with parameter substitution.  Due to order of
operations (parameters before globs -- otherwise $SD/autoload/* would
not work) you can't do this via substitution.

Fortunately there are a lot of things you can do with globbing that
mimic parameter substitution, and :t happens to be one of them; you
can use it as a glob qualifier:

FUNCS=( $SD/autoload/*(:t) )



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