Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: is variable with variable name possible?
- X-seq: zsh-users 15942
- From: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: is variable with variable name possible?
- Date: Tue, 5 Apr 2011 19:39:48 +0100
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1302028790; bh=VaMbSlaGuPuNzGWWyKAMBuWXOQeNE0VbZW1DC64gsFA=; h=X-Yahoo-Newman-Id:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent; b=un34IJ4IO/apgVqqFHj1a4w6VuYRC04mqtFp/r38momlE96yyaFV4hgLzkpACom8ZRGrBIRwoccxw3Yjp4Otgb94OAhi7rhFS0G2X8id2WurdMXTu7KZXe3J3lsHrJ9igJhBo7qnruoWNlwbVL6kgAcl/j6C5iYkYE53wueGn20=
- In-reply-to: <BANLkTi=d4quZVj3EdqFZtcqWSs_i=uN=fw@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>
- Mail-followup-to: Mikael Magnusson <mikachu@xxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <Xns9EBD94C46B8C1zzappergmailcom@80.91.229.10> <BANLkTimegXA4_5Co4sSWKgOmY_U-EWE6Pg@mail.gmail.com> <20110404140651.GA9371@yahoo.fr> <BANLkTikffaVdTwNChVZzE6nKh3u9JMMyMA@mail.gmail.com> <20110404162824.GB9371@yahoo.fr> <BANLkTimU=NGp8eMkQKmNony3n4sR8ezreQ@mail.gmail.com> <20110404205002.GD9371@yahoo.fr> <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author