Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: simple substitution?
- X-seq: zsh-users 14302
- From: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
- To: tartifola@xxxxxxxxx
- Subject: Re: simple substitution?
- Date: Wed, 12 Aug 2009 13:04:18 +0100
- Cc: zsh-users@xxxxxxxxxx
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=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=eMKZut0Bia6b5sckT0NXj+2f6NQoHnIqN+2bEiAt5UkYA6sqzFkdDKFukO/Fb9pP6UF14je3iTAzavNARz06mXkfNOYpMYGA3k+w+EVLD6DX+76Jl8MdFdLP/sTzbsHpx2XX/C/tV+4EpF6RzCFzKUd1exxIs+G6B9wzfdOKI0w= ;
- In-reply-to: <20090812133916.6ab5adcf.tartifola@xxxxxxxxx>
- Mail-followup-to: tartifola@xxxxxxxxx, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20090812133916.6ab5adcf.tartifola@xxxxxxxxx>
2009-08-12 13:39:16 +0200, tartifola@xxxxxxxxx:
>
> Hi,
> I'm trying to understand expansion end substitution and I'm lost in
> what should be a simple substitution. Here my example
>
> >foo=4
> >echo ${foo}
> 4
> >FO=fo
> >O=o
> >echo \${${FO}${O}}
> ${foo}
>
> while I was expecting '4'. What am I missing?
eval.
eval "echo \${${FO}${O}}"
or
eval "echo \${$FO$O}"
See also:
echo ${(P)${:-$FO$O}}
or
echo ${(e)${:-\${$FO$O}}}
see:
info zsh 'Parameter Expansion'
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author