Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: help with dereferencing variables
- X-seq: zsh-users 7060
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh users <zsh-users@xxxxxxxxxx>
- Subject: Re: help with dereferencing variables
- Date: Sun, 15 Feb 2004 17:04:05 +0000
- In-reply-to: <200402142012.51392.scowles@xxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <200402140959.24015.scowles@xxxxxxxxxxxxx> <1040214212400.ZM15293@xxxxxxxxxxxxxxxxxxxxxxx> <200402142012.51392.scowles@xxxxxxxxxxxxx>
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"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author