zsh-users
 help / color / mirror / code / Atom feed
From: Lloyd Zusman <ljz@asfast.com>
To: zsh-users@sunsite.dk
Subject: Forcing expansion without explicit eval nor a subshell?
Date: Fri, 04 Nov 2005 23:01:54 -0500	[thread overview]
Message-ID: <m364r73fpp.fsf@asfast.com> (raw)

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@asfast.com
 God bless you.


             reply	other threads:[~2005-11-05  4:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-05  4:01 Lloyd Zusman [this message]
2005-11-05  8:45 ` DervishD
2005-11-05 19:56 ` Bart Schaefer
2005-11-05 20:03   ` Lloyd Zusman
2005-11-05 21:33     ` Bart Schaefer
2005-11-05 22:07       ` Lloyd Zusman
2005-11-05 22:44         ` OT: poldek [Re: Forcing expansion without explicit eval nor a subshell?] GoTaR
2005-11-06  3:02         ` Forcing expansion without explicit eval nor a subshell? Bart Schaefer
2005-11-06  3:40           ` Lloyd Zusman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m364r73fpp.fsf@asfast.com \
    --to=ljz@asfast.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).