Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Expanding a variable extracted from another file
- X-seq: zsh-users 24842
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh MailingList <zsh-users@xxxxxxx>
- Subject: Re: Expanding a variable extracted from another file
- Date: Sat, 16 May 2020 09:58:10 -0700
- Cc: TJ Luoma <luomat@xxxxxxxxx>
- In-reply-to: <CAN=4vMpoRbvUN3NCQiQreL0w8Gs7dqnGFNu_W-oroVA1bYEGHA@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: <CADjGqHt8oF0W9AEU+j+yJHfOxxrVh-6HFP8ediAT0A_+qX9N8A@mail.gmail.com> <CAH+w=7ZXCu__nZwGEjsJ8vrXUsXommS=EkH-ScJ+tKLw2ph8hg@mail.gmail.com> <CAN=4vMpoRbvUN3NCQiQreL0w8Gs7dqnGFNu_W-oroVA1bYEGHA@mail.gmail.com>
On Sat, May 16, 2020 at 12:14 AM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> What is the meaning of quotes? Are these all equivalent?
>
> "$HOME/foo/bar"
> '$HOME/foo/bar'
> $HOME/foo/bar
> \$HOME/foo/bar
>
> Code posted by Bart assumes that they are. ${(Qe)MYVAR} have the same
> value if MYVAR is set to any of these lines.
You're correct about Q but only the one with a backslash seems to make
any difference to ${(e)...}:
% print -rl -- $quotings
"$HOME/foo/bar"
'$HOME/foo/bar'
$HOME/foo/bar
\$HOME/foo/bar
$'$HOME/foo/bar'
% print -rl -- ${(e)quotings}
"/Users/schaefer/foo/bar"
'/Users/schaefer/foo/bar'
/Users/schaefer/foo/bar
$HOME/foo/bar
$'/Users/schaefer/foo/bar'
%
Compare this, which is I'm sure what you were thinking of:
% eval print -rl -- $quotings
/Users/schaefer/foo/bar
$HOME/foo/bar
/Users/schaefer/foo/bar
$HOME/foo/bar
$HOME/foo/bar
%
Messages sorted by:
Reverse Date,
Date,
Thread,
Author