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

Forcing expansion without explicit eval nor a subshell?



Suppose I have the following variable defined:

  yumargs='--disablerepo=livna{,-updates,-testing,-extras}'

I know that I can do this:

  eval yum ${yumargs} update

And this:

  yum $(eval print -- ${yumargs}) update

In both cases, it expands to this before execution (line wrapping added
for clarity):

  yum --disablerepo=livna         \
      --disablerepo=livna-updates \
      --disablerepo=livna-testing \
      --disablerepo=livna-extras  \
      update

However, I'm wondering if there is a way to get the same effect without
explicitly using "eval" and without invoking a subshell via the $()
construct (nor with its moral equivalent, ``).

I want to assign to "yumargs" exactly as I did above, if possible, and
I'm looking for some combination of modifiers within the ${} construct
which would give me the expansion of "yumargs" that I desire, and
without the need for a subshell.  And I'd like the expansion of
"yumargs" to take place at the time it is used in the "yum" command, not
at the time that I define it.

Is all this possible?  If so, could someone give me a hint or pointer?

By the way, I tried the (e) operator within the ${} construct, but that
didn't work for me.

Thanks in advance for your suggestions.


-- 
 Lloyd Zusman
 ljz@xxxxxxxxxx
 God bless you.



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