zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh users <zsh-users@sunsite.dk>
Subject: Re: help with dereferencing variables
Date: Sun, 15 Feb 2004 17:04:05 +0000	[thread overview]
Message-ID: <1040215170405.ZM21382@candle.brasslantern.com> (raw)
In-Reply-To: <200402142012.51392.scowles@earthlink.net>

On Feb 14,  8:12pm, S. Cowles wrote:
} 
} Many thanks; that was the info I was missing. One small aesthetics
} preference following up on your suggestion and I'm away (does not
} preserve newlines in the array element assignments):
}
} eval ${key}\=\( ${(P)val} \)

This is not equivalent to my suggestion nor to your "method 2".  It's
a bit closer to your "method 1".  In the above formulation, ${(P)val}
is expanded _before_ being eval'd.  That means that spaces and quotes
and other shell syntax in the expansion are re-parsed.

Compare:

key=tmp
val=row
row='this is a row that may );( print oops in a subshell'
eval ${key}\=\( ${(P)val} \)
print "$tmp"
eval ${key}'=( ${(P)val} )'
print "$tmp"


      reply	other threads:[~2004-02-15 17:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-14 17:59 S. Cowles
2004-02-14 21:24 ` Bart Schaefer
2004-02-15  4:12   ` S. Cowles
2004-02-15 17:04     ` Bart Schaefer [this message]

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=1040215170405.ZM21382@candle.brasslantern.com \
    --to=schaefer@brasslantern.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).