Re: creation of a variable from another variable (another posting)
From: Stephane CHAZELAS (this.address_at_is.invalid)
Date: 01/22/05
- Previous message: Norm Dresner: "Re: (t)csh file existence check with wildcards"
- In reply to: Rakesh Sharma: "Re: creation of a variable from another variable (another posting)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 22 Jan 2005 11:06:03 +0000
2005-01-21, 19:11(-08), Rakesh Sharma:
[...]
>> for arch in S I
>> do
>> ls $GOT_FLAG_$arch
>> ^^^^^^^^^^^^^^^
>> trying to construct $GOT_FLAG_S and $GOT_FLAG_I
>> combo of 2 variables...what is syntax?
[...]
> In one step(with mixed quotes):
> eval 'ls "$'GOT_FLAG_$arch\"
eval 'ls -- "$'GOT_FLAG_"$arch"\"
> In one step(with same quotes):
> eval "ls \"\$GOT_FLAG_$arch\""
>
> Or step-by-step:
> VarName=GOT_FLAG_$arch
> eval "VarValue=\$$VarName"
> ls "$VarValue"
Yes, using an intermediate variable makes things easier.
-- Stéphane
- Previous message: Norm Dresner: "Re: (t)csh file existence check with wildcards"
- In reply to: Rakesh Sharma: "Re: creation of a variable from another variable (another posting)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]