Re: extrapoled variable
From: Stephane CHAZELAS (this.address_at_is.invalid)
Date: 01/28/05
- Next message: Villy Kruse: "Re: find files by extensions"
- Previous message: Nunya Bizness: "Re: unix shell script ignores 'exit' when in function that is piped to tee"
- In reply to: William: "Re: extrapoled variable"
- Next in thread: William: "Re: extrapoled variable"
- Reply: William: "Re: extrapoled variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 28 Jan 2005 07:57:36 +0000
2005-01-27, 13:32(-06), William:
> "yannouch" <yann@yannouch.net> wrote in message
> news:84158b3a.0501271028.194f5160@posting.google.com...
>>
>> I want to get the content of FOOBAR in C using A and B, something like
>>
>> C=${$A$B}
>>
>> I've already done it before but can't remember the correct syntax.
>> Does anybody know ?
>
> eval 'C="$'$A$B\"
>
> should do it. -Wm
[...]
But then $A$B is subject to word splitting and filename
generation as they are not quoted. Also note that if $A is "1"
and $B is "2" for instance, it may not work as expected.
eval "C=\${$A$B}"
Should be enough.
-- Stéphane
- Next message: Villy Kruse: "Re: find files by extensions"
- Previous message: Nunya Bizness: "Re: unix shell script ignores 'exit' when in function that is piped to tee"
- In reply to: William: "Re: extrapoled variable"
- Next in thread: William: "Re: extrapoled variable"
- Reply: William: "Re: extrapoled variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|