zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh MailingList <zsh-users@zsh.org>
Cc: TJ Luoma <luomat@gmail.com>
Subject: Re: Expanding a variable extracted from another file
Date: Sat, 16 May 2020 09:58:10 -0700	[thread overview]
Message-ID: <CAH+w=7Y_+FxFQSSt5dBv=wMg8PJntrvM5Ytjd1sNUSF02dVXzQ@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMpoRbvUN3NCQiQreL0w8Gs7dqnGFNu_W-oroVA1bYEGHA@mail.gmail.com>

On Sat, May 16, 2020 at 12:14 AM Roman Perepelitsa
<roman.perepelitsa@gmail.com> 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
%

  reply	other threads:[~2020-05-16 16:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-16  6:46 TJ Luoma
2020-05-16  7:03 ` Bart Schaefer
2020-05-16  7:13   ` Roman Perepelitsa
2020-05-16 16:58     ` Bart Schaefer [this message]
2020-05-17 12:10   ` TJ Luoma
2020-05-16 21:27 ` Daniel Shahaf

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='CAH+w=7Y_+FxFQSSt5dBv=wMg8PJntrvM5Ytjd1sNUSF02dVXzQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=luomat@gmail.com \
    --cc=zsh-users@zsh.org \
    /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).