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

Re: Forcing expansion without explicit eval nor a subshell?



On Nov 5,  3:03pm, Lloyd Zusman wrote:
}
} I want to defer it in case I do this:
} 
}   yumargs='--disablerepo={dag,$livnastuff}'
} 
} ... where $livnastuff can change, and where it might or might not
} involve more brace expansions.

The answer is still to stop thinking about brace expansions and start
thinking about array expansions.

    yumargs=( --disablerepo={dag,'$^livnastuff'} )
    livnastuff=( dries extras )
    yum ${(e)yumargs}

You can keep abstracting this out:

    reponames=( dag '$^livnastuff' )
    yumargs=( --disablerepo=$^reponames )
    livnastuff=( dries extras )
    yum ${(e)yumargs}

Or

    pkgnames=( kernel '$^livnapkgs' )
    reponames=( dag '$^livnarepos' )
    yumargs=( --exclude='${(e)^pkgnames}' --disablerepo='${(e)^reponames}' )
    livnarepos=( dries extras )
    yum ${(e)yumargs}



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