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

Re: Forcing expansion without explicit eval nor a subshell?



On Nov 5,  5:07pm, Lloyd Zusman wrote:
}
} I can't figure out how to do the nesting stuff using arrays, without
} things getting rather complex.

You do end up needing one array for each level of nesting.

E.g.:

    yumargs=( --disablerepo='${(e)^disablerepos}' )
    disablerepos=( dag '${(e)^livnarepos' )
    livnarepos=( livna{,-updates,-extras,-testing} )

    yum ${(e)yumargs}

This corresponds to your example

    yum --disablerepo={dag,livna{,-updates,-extras,-testing}}

The extra arrays are the price you pay for wanting to avoid defining
e.g. $livnarepos until the last minute and also avoid eval.

You might also ask yourself whether there's another way to get the end
result that you want, such as writing a wrapper function around yum.



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