Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: is variable with variable name possible?



2011/4/4 Stephane Chazelas <stephane_chazelas@xxxxxxxx>:
> 2011-04-04 15:48:32 +0200, Jérémie Roquet:
> [...]
>> 2011/4/4 zzapper <david@xxxxxxxxxx>:
>> > somevar=$(pwd)
>> >
>> > but I want somevar to be a variable name
>>
>> $ eval "$somevar=$(pwd)"
> [...]
>
> No!
>
> eval "$somevar=\$(pwd)"
> or
> eval "$somevar=\$PWD"
>
>
> Or think of what would happen if $PWD was "/tmp/x;rm -rf /home"

Oh, right!

-- 
Jérémie



Messages sorted by: Reverse Date, Date, Thread, Author