Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: variable expansion inside string
- X-seq: zsh-users 24116
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Zsh-Users List <zsh-users@xxxxxxx>
- Subject: Re: variable expansion inside string
- Date: Tue, 30 Jul 2019 15:15:30 +0100
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190730141532euoutp01d16e1b4a61810e9f3e439bb25bcc900d~2NPGXoJlW2687726877euoutp01z
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1564496132; bh=lp142L6VJB/G14TjF68kqrrcVTzTOLp5+2HBCjy2ERo=; h=Subject:From:To:Date:In-Reply-To:References:From; b=o91C3iSLEaXxZlGs9nCKe28S5jTGUkBJaksKsipyTmLP28rC3qWzAixJhKjFLNlMe juOJKndfgzHI0LDk2Egvr2pbv1OJcJogo65hVsXacEPhcYlMejXsxTJ0j2D9S2j7TC jFsrTikT4nMRjyGIxXB8rZC2CAYUqCmen9o/l2do=
- In-reply-to: <CAP+y1xBYuRoak6C07rP__sy6ycm2UF_SdChAH4_YvHCkGjGMEQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CGME20190730123021epcas1p21671587b575bd82a2512bcb1fa091563@epcas1p2.samsung.com> <CAP+y1xAZiPn1B-GDPZw27fzBMdXSHbr+N3cgJBjOe_MeKG=0vw@mail.gmail.com> <1564492687.5815.4.camel@samsung.com> <CAP+y1xBYuRoak6C07rP__sy6ycm2UF_SdChAH4_YvHCkGjGMEQ@mail.gmail.com>
So really what you're trying to do is: given a variable "a" containing
exactly the literal characters
*$file*
(however they got there) expand any variable references, but nothing
else.
The nearest I can think of is:
print -r -- "${(e):-$a}"
That won't be limited to just variables, it'll do other sorts
of expansion, but it won't do globbing, and you don't have the
hairiness of an "eval".
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author