From: Stephane Chazelas <stephane_chazelas@yahoo.fr>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: is variable with variable name possible?
Date: Tue, 5 Apr 2011 19:39:48 +0100 [thread overview]
Message-ID: <20110405183948.GA7053@yahoo.fr> (raw)
In-Reply-To: <BANLkTi=d4quZVj3EdqFZtcqWSs_i=uN=fw@mail.gmail.com>
2011-04-05 00:32:27 +0200, Mikael Magnusson:
[...]
> > eval "$somevar=\$PWD"
> >
> > is more legible and more portable.
>
> But your quotes do nothing (assuming $somevar has a sane value), did you mean
> eval $somevar=\"\$PWD\"
> or possibly more readable version
> eval $somevar='"$PWD"'
Those double quotes are not necessary.
> ? AFAICT, it works without any quotes with globsubst and shwordsplit
> set too though, as long as you quote the $ in $PWD, tried in both zsh
> and bash.
[...]
If you don't quote $somevar, you ask the shell to split it which
it will do according to the current value of IFS (assuming
shwordsplit).
If you quote it, you don't have to worry what the value of $IFS
is.
--
Stephane
next prev parent reply other threads:[~2011-04-05 18:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-04 13:37 zzapper
2011-04-04 13:48 ` Jérémie Roquet
2011-04-04 13:51 ` Jérémie Roquet
2011-04-04 14:13 ` zzapper
2011-04-04 14:26 ` Bart Schaefer
2011-04-05 8:31 ` Bart Schaefer
2011-04-04 14:06 ` Stephane Chazelas
2011-04-04 14:25 ` Mikael Magnusson
2011-04-04 16:28 ` Stephane Chazelas
2011-04-04 16:34 ` Mikael Magnusson
2011-04-04 20:50 ` Stephane Chazelas
2011-04-04 22:32 ` Mikael Magnusson
2011-04-05 18:39 ` Stephane Chazelas [this message]
2011-04-05 2:54 ` Aaron Davies
2011-04-05 3:54 ` Phil Pennock
2011-04-05 4:04 ` ZyX
2011-04-05 4:10 ` ZyX
2011-04-04 14:33 ` Jérémie Roquet
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=20110405183948.GA7053@yahoo.fr \
--to=stephane_chazelas@yahoo.fr \
--cc=mikachu@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).