Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: variable expansion inside string
- X-seq: zsh-users 24114
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: <zsh-users@xxxxxxx>
- Subject: Re: variable expansion inside string
- Date: Tue, 30 Jul 2019 14:18:07 +0100
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190730131810euoutp027ce83a667f5e9077afa1bf5b369f797e~2MdAhBumJ3138131381euoutp02i
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1564492690; bh=ulQ8o64c0mIHZ9a+amXr8/K5HsEeJsl/r8t4m99lCiM=; h=Subject:From:To:Date:In-Reply-To:References:From; b=JmKECl8GYcdZ6GTDn67mUm5cdtYyGMny8dS1T1ItYAJbQN2Qw6X/suWn/a4UYG/du 7KTG2lfr9oSsXs7rAO7HXB5f0bK8rFNb3Qy9dze8SxpKJ5+w4BU7wZr93xdLG/qHBs 1z2wbKFmyUvcFvCZZ+tEbVLwidwxLht+6fBfJrbI=
- In-reply-to: <CAP+y1xAZiPn1B-GDPZw27fzBMdXSHbr+N3cgJBjOe_MeKG=0vw@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>
On Tue, 2019-07-30 at 14:28 +0200, Pier Paolo Grassi wrote:
> Hello, is it possibile to do only variable expansion inside a string, eg:
>
> file="filename.txt"
> a="*$file*"
If you run zsh -f, you'll see that that's exactly what you normally get, just
by running
print "$a"
--- no eval.
My best guess is you have the option globsubst set and when you tried
to print the result, you didn't use double quotes at that point, i.e.
you had something like
print $a
and the *filename.text* got expanded at that point.
So the original code is actually fine.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author